Tkinter: cleaning up when a toplevel is destroyed

Matthew Dixon Cowles matt at mondoinfo.com
Fri Nov 16 14:32:33 EST 2001


On Thu, 15 Nov 2001 14:59:41 -0800, David R. Smith
<drs at labs.agilent.com> wrote:

>I have a problem with how to delete a data structure when the user
>deletes the associated toplevel window by clicking on its X-button in
>the upper right corner.

I think you want something like:

root.protocol("WM_DELETE_WINDOW", destroyCB)

The call is documented in Fredrik Lundh's excellent An Introduction
to Tkinter at (wrapped for line length):

http://www.pythonware.com/library/tkinter/
  introduction/events-and-bindings.htm

Regards,
Matt



More information about the Python-list mailing list