WxPython写入自动补偿

2024-10-01 11:24:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我在用wxPython(凤凰城)。 我编写了一个带有自定义自动完成程序的小应用程序,根据这些guidelines,但它失败了,并出现以下错误:

Traceback (most recent call last):
  File "try2.py", line 33, in <module>
    frame = TextFrame()
  File "try2.py", line 26, in __init__
    basicText.AutoComplete(MyTextCompleter)
TypeError: TextEntry.AutoComplete(): arguments did not match any overloaded call:
  overload 1: argument 1 has unexpected type 'sip.wrappertype'
  overload 2: argument 1 has unexpected type 'sip.wrappertype' 

代码如下:

^{pr2}$

当注释掉basicText.AutoComplete(MyTextCompleter)时,它成功运行(没有自动完成)


Tags: inpytypelinecallargumentautocompletefile
2条回答

我应该更深刻地警告您:wxpythonphoenix是wxPython的未来(因为与经典相比,它也支持python3)。也就是说,这并不意味着一切都是美好和闪亮的。我个人的建议是继续使用classic(或者换句话说:现在在classic中有效的,很可能在Phoenix也可以)。在凤凰城,你会更频繁地遇到这样的虫子。在

幸运的是,在这种特殊情况下,已经做了其他事情:

<wx.TextCtrl>.AutoComplete(…)不接受字符串列表。这已经在2.9.0/classic中使用了。见documentation for ^{}/AutoComplete。在

您需要将MyTextCompleter的实例传递给wx.TextCtrl.AutoComplete(). 更改此项:

        basicText.AutoComplete(MyTextCompleter)

^{pr2}$

相关问题 更多 >