Tk's default Toplevel - counterintuitive

Guido van Rossum guido at
Fri Aug 20 16:44:10 CEST 1999

"Fredrik Lundh" <fredrik at> writes:

> Guido van Rossum <guido at> 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:

More information about the Python-list mailing list