[英]Python 3 does not give a clean exit
单击“退出”按钮时,此代码不会提供干净的退出。 相反,它挂起,离开了死亡的GUI。 我们可以解决这个问题吗? Python 2中的类似程序表现得很好。
from tkinter import *
import sys
root=Tk()
def quit():
sys.exit("quitting")
frame=Frame()
frame.pack()
x=Label(root,text='Label')
x.pack()
y=Button(root,text='Button')
y.pack()
z=Button(root,text='Exit',command=quit)
z.pack()
root.mainloop()
def quit():
root.destroy()
应该管用...?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.