本文共 292 字,大约阅读时间需要 1 分钟。
from tkinter import Tkfrom tkinter import messageboxroot = Tk()# 当点击右上角退出时,执行的程序def on_closing(): if messagebox.askokcancel("Quit", "Do you want to quit?"): root.destroy()# WM_DELETE_WINDOW 不能改变,这是捕获命令root.protocol('WM_DELETE_WINDOW', on_closing)root.mainloop()
转载地址:http://tfhof.baihongyu.com/