📜  tkinter 绑定到窗口关闭 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:42.968000             🧑  作者: Mango

代码示例1
def on_closing():
    if messagebox.askokcancel("Quit", "Do you want to quit?"):
        root.destroy()

root.protocol("WM_DELETE_WINDOW", on_closing)
root.mainloop()