Detect TKinter window being closed?
adonisv at DELETETHISTEXTearthlink.net
Fri Dec 2 11:19:39 EST 2005
> Is it possible to to detect a Tkinter top-level window being closed with the
> close icon/button (top right), for example to call a function before the
> window actually closes?
> Python 2.4 / Linux (2.6 kernel) if that makes any difference.
> Any info would be greatly appreciated.
Here is an example code taken from:
(located at very end)
Example 7-2. Capturing destroy events
# File: protocol1.py
from Tkinter import *
if tkMessageBox.askokcancel("Quit", "Do you really wish to quit?"):
root = Tk()
Hope this helps.
More information about the Python-list