Tk's default Toplevel - counterintuitive

Guido van Rossum guido at cnri.reston.va.us
Fri Aug 20 16:44:10 CEST 1999


"Fredrik Lundh" <fredrik at pythonware.com> writes:

> Guido van Rossum <guido at cnri.reston.va.us> wrote:
> > Actually, the accepted idiom (all over the place in code I write) is
> > 
> >         toplevel_window.protocol("WM_DELETE_WINDOW", close_callback)
> > 
> > The close_callback function takes no arguments.  In simple cases, you
> > can use
> > 
> > root.protocol("WM_DELETE_WINDOW", root.destroy)
> > 
> > or
> > 
> > root.protocol("WM_DELETE_WINDOW", root.quit)
> 
> how about making the destroy variant the
> default?

Good idea.  I've thought of this before, and somehow never got to it.

I can't see any reason not to do it; I believe this is the default in
Tk anyway, but Tkinter's destroy() does a little more than Tk's
internal destroy.  Unless I hear a clamor of complaints I'll go ahead
and do this.

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list