问题描述
我已经学习 Python2.7 有一段时间了.我正在使用 Windows 7 64 位 BTW.我开始学习 GUI 并为此尝试使用 wxpython 和 IDLE.所以我输入了一些代码:
I have been learning Python2.7 for a little bit now. I'm using Windows 7 64 bit BTW. I started learning GUI's and have been trying to use wxpython and IDLE for this. So I type out some code:
import wx
app = wx.App()
win = wx.Frame(None)
win.Show()
app.MainLoop()
我运行程序,弹出窗口,但蓝色甜甜圈在那里.我尝试关闭窗口,它说 pythonw.exe 没有响应.另一个关于 wxpython 的窗口会弹出.它说:
I run the program, and the window pops up, but the blue doughnut is there. I try to close the window, and it says that pythonw.exe is not responding. Another window pops up about wxpython. It says:
wxPython stdout/stderr(Not Responding)
Traceback (most recent call last):
**IDLE Internal Exception:
File "C:\Python27\lib\idlelib\run.py", line 93, in main
seq, request = rpc.request_queue.get(block=True, timeout=0.05)
File "C:\Python27\lib\Queue.py", line 177, in get
self.not_empty.wait(remaining)
File "C:\Python27\lib\threading.py", line 263, in wait
_sleep(delay)
typeError: 'int' object is not callable
出了什么问题,我该如何解决?
What is wrong and how do I fix it?
谢谢.
推荐答案
崩溃最有可能发生在您尝试启动事件循环时.请参阅此错误报告:http://bugs.python.org/issue989712
The crash is most likely happening at the point when you try and start the event loop. See this bug report: http://bugs.python.org/issue989712
似乎其他人已经尝试创建扩展来处理此功能:http://idlex.sourceforge.net/extensions.html
Seems someone else has gone as far to try and create an extension to handle this ability: http://idlex.sourceforge.net/extensions.html
基本上,不要在 IDLE 中执行此操作.编写脚本并直接从 shell 或脚本运行它(如果在 Windows 中),通过使用 .pyw 扩展名命名并双击它.IDLE 自己的事件循环与 GUI 工具包中的事件循环之间显然存在冲突.
Basically, don't do this from IDLE. Write a script and run it from the shell or the script directly if in windows, by naming it with a .pyw extension and double clicking it. There is apparently a conflict between IDLE's own event loop and the ones from GUI toolkits.
这篇关于pythonw.exe 没有响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!