[Tkinter-discuss] main window closing when dialogs are open

Bencsik Roland roland.bencsik at ludensis.hu
Tue Oct 17 12:54:43 CEST 2006



Michael Lange wrote:
> Hi Roland,
> 
> I don't know if this is possible at all, even sys.exit() does not seem to work.
> Maybe instead of the additional warning dialog you could change the WM_DELETE_WINDOW
> callback while the dialog is up, like
> 
>     def info(self):
>         self.owner.protocol('WM_DELETE_WINDOW', self.bell)
>         tkMessageBox.showinfo()
>         self.owner.protocol('WM_DELETE_WINDOW', self.quit)
> 
> However this might become complicated in a bigger app with lots of message boxes.
> Maybe a separate messagebox module would help.

Using bell sounds well, maybe I will use it, thanks.

> Alternatively you could write your own replacement for tkMessageBox; if the
> dialog is derived from Toplevel you should be able to close all windows from
> the main window's "close" button.

Beside tkMessageBox I would like to use the file/directory choosing 
methods from tkFileDialog which seems to me that I can not simply 
replace with my own variant.
If there is no simple way to do this window closing thing then I will 
stay at the warning dialog or the bell ringing.

Thanks for your help,
Roland




More information about the Tkinter-discuss mailing list