Reputation: 3
In this example:
frame = wx.Frame(parent=None, title='Hello, World!')
Auto completion work for wx.Frame
but don't work in parentheses. So when i'm write par
it did't auto-complete for parent=
.
I tried google it but didn't find answer.
I'm using PyCharm Community 2019.3 . Miniconda3 with Python 3.7.4 . wxpython 4.0.4
Could you please navigate to Frame definition by Right Click on it - Go To - Declaration or Usages. What parameters does its constructor have?
def __init__(self, *args, **kw):
"""
Frame()
Frame(parent, id=ID_ANY, title=EmptyString, pos=DefaultPosition, size=DefaultSize, style=DEFAULT_FRAME_STYLE, name=FrameNameStr)
A frame is a window whose size and position can (usually) be changed
by the user.
"""
It shows a \Miniconda3\Lib\site-packages\wx\core.pyi
file with Frame
class inside.
Upvotes: 0
Views: 106
Reputation: 6206
Since the C++ wxFrame
constructor is overloaded then we need to use *args, **kw
to be able to match either overload. However, the two overloads are given at the start of the docstring, so you can still get the info that way, and more details are present in the documentation at https://docs.wxpython.org/.
There are some plans to improve the code that is generated into the .pyi
files, including using type hint annotations and the typing.overload
decorator, but it may be awhile before that is done.
Upvotes: 2