How to terminate a TkinterApp correctly?
Michael Peuser
mpeuser at web.de
Sat Aug 16 06:34:20 EDT 2003
I just notice a left over line from a test, that lambda is of no use at all!
May be you will have to use WM_SAVE_YOURSELF instead of WM_DELETE_WINDOWS if
you want to be sure to keep the widget absolutly intact. Between these two
messages some tidying-up could aleady have happened behind the scene....So
this is my fine example:
-----------------------------
from Tkinter import *
def killingAction(ev):
print "Destroyed"
def kidding():
print "not killing"
l.config(text="just kidding")
l.master.protocol("WM_DELETE_WINDOW",original)
l=Label(text="Kill me!")
l.pack()
l.bind("<Destroy>",killingAction)
original= l.master.protocol("WM_DELETE_WINDOW",None)
l.master.protocol("WM_DELETE_WINDOW",kidding)
mainloop()
-------------------------------------------
Kindly
Michael P
More information about the Python-list
mailing list