Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python,wxPython错误_Python_Wxpython_Pywin - Fatal编程技术网

Python,wxPython错误

Python,wxPython错误,python,wxpython,pywin,Python,Wxpython,Pywin,有人能帮我找出我做错了什么吗?我对GUI几乎没有经验。 代码: 错误: PyNoAppError: The wx.App object must be created first! win32ui.error: Error in Command Message handler for command ID 36864, Code 0 这段代码在Windows7上运行,带有WxPython2.8.12.1和Python2.6.6。您使用的是什么操作系统和Python版本?当我在空闲状态下运行代

有人能帮我找出我做错了什么吗?我对GUI几乎没有经验。 代码:

错误:

PyNoAppError: The wx.App object must be created first!

win32ui.error: Error in Command Message handler for command ID 36864, Code 0

这段代码在Windows7上运行,带有WxPython2.8.12.1和Python2.6.6。您使用的是什么操作系统和Python版本?当我在空闲状态下运行代码时,我经常看到这个错误消息。如果你这么做了,那就别这么做。Tkinter的主循环(空闲时使用的主循环)将干扰其他GUI工具包的主循环


closebutton方法中存在一个问题,它调用一个不存在的“close”方法

请尝试修复代码的缩进,以便所有内容都按照文本编辑器中的显示方式缩进-这在Python中非常重要。我认为您不需要第三个参数
self.Bind(wx.EVT\u BUTTON,self.closebutton,BUTTON)
这是完整的回溯吗?它能告诉你错误来自哪一行吗?@JoranBeasley-事实上这是正确的。查看更多信息哦,你的权利,我以为他是直接绑定到按钮上的:P
PyNoAppError: The wx.App object must be created first!

win32ui.error: Error in Command Message handler for command ID 36864, Code 0