[Tkinter-discuss] Trapping event for Toplevel()

Gerardo Juarez gerardo at computo-industrial.com.mx
Tue Aug 7 17:08:30 CEST 2007


Hi,

I would like to know if there is a way to trap the kill button event in a 
Toplevel window. I'm having problems with a dialog which has a "Close" 
button, but users keep closing it with the kill button (the big X at the 
upper right corner). After such a close, the application refuses to 
re-open the dialog, throwing instead an exception:

File "C:\PYTHON24\lib\lib-tk\Tkinter.py", line 1541, in wm_withdraw
   return self.tk.call('wm', 'withdraw', self._w)
TclError: bad window path name ".14221680"

My guess is that I must trap the kill event as well but I don't know how 
to do it.

Gerardo



More information about the Tkinter-discuss mailing list