2
我很难开始使用Tkinter。我试图关闭所有的窗户似乎都崩溃了。 (也就是说,它们会将IDLE中的执行返回到提示符,但窗口保持打开状态并且退出按钮保持按下状态。窗口无响应,必须在Windows中手动终止。) 最直接的示例来自“The Quick Python Book“。下面是代码:Tkinter窗口在出口崩溃
from tkinter import *
import sys
win = Tk()
b = Button(win, text="Goodbye",command=sys.exit)
b.pack()
mainloop()
的Python给了我以下错误信息:
Traceback (most recent call last):
File "C:/Python Scripts/Quick Python Practice Programs/TKinter Practice.py", line
6, in <module>
mainloop()
File "C:\Python32\lib\tkinter\__init__.py", line 317, in mainloop
_default_root.tk.mainloop(n)
File "C:\Python32\lib\tkinter\__init__.py", line 1401, in __call__
raise SystemExit(msg)
SystemExit
我从空闲外壳调用这个,我敢肯定它是不是设置为==没有子进程==。当我重新启动shell时,我得到==重新启动==。
任何帮助,将不胜感激。
如果您尝试win.mainloop()而不是mainloop() – Brandon
唉,结果相同。尽管感谢您的快速回答。 更多数据:Windows 7,Python 3.2。 – user1910935