【发布时间】:2018-01-25 08:22:38
【问题描述】:
我是 Python 新手,我想使用像 WM_DELETE_WINDOW、WM_TAKE_FOCUS 和 WM_SAVE_YOURSELF 这样的协议。我找到了一个WM_DELETE_WINDOW 的例子,它很清楚可以理解。但我想了解其余两个协议。他们是做什么的?
from Tkinter import *
import tkMessageBox
root = Tk()
def on_closing():
if tkMessageBox.askokcancel("Quit", "Do you want to quit?"):
root.destroy()
root.protocol("WM_DELETE_WINDOW", on_closing)
root.mainloop()
【问题讨论】:
标签: python python-2.7 python-3.x tkinter