当我创建一个subwindow (toplevel)
时,我无法一键关闭主窗口。我必须单击交叉并确定,times(+1)
就像我调用的函数一样:
import tkMessageBox
from Tkinter import *
def cross():
if tkMessageBox.askokcancel(u"Quit ATTA Convertor ?", "Are you sure you want to close the window ?"):
mainwin.quit()
def about():
subwin = Toplevel(mainwin)
subwin.mainloop()
mainwin = Tk()
mainwin.protocol("WM_DELETE_WINDOW", cross)
mainMenu = Menu(mainwin)
mainMenu.add_command(label="about...", command=about)
mainwin.config(menu=mainMenu)
mainwin.mainloop()