简体   繁体   English

PyCharm 社区版中 WxPython 的不完全自动完成

[英]Not full auto completion for WxPython in PyCharm Community Edition

In this example:在这个例子中:

frame = wx.Frame(parent=None, title='Hello, World!')

Auto completion work for wx.Frame but don't work in parentheses. wx.Frame自动完成工作但不在括号中工作。 So when i'm write par it did't auto-complete for parent= .所以当我写par它没有自动完成parent=

I tried google it but didn't find answer.我试过谷歌它,但没有找到答案。

I'm using PyCharm Community 2019.3 .我正在使用 PyCharm 社区 2019.3 。 Miniconda3 with Python 3.7.4 . Miniconda3 与 Python 3.7.4 。 wxpython 4.0.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.它显示了一个\\Miniconda3\\Lib\\site-packages\\wx\\core.pyi文件,其中包含Frame类。

Since the C++ wxFrame constructor is overloaded then we need to use *args, **kw to be able to match either overload.由于 C++ wxFrame构造函数已重载,因此我们需要使用*args, **kw来匹配任一重载。 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/ .但是,这两个重载在文档字符串的开头给出,因此您仍然可以通过这种方式获取信息,更多详细信息请参见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.有一些计划改进生成到.pyi文件中的代码,包括使用类型提示注释和typing.overload装饰器,但可能需要一段时间才能完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM