[Tkinter-discuss] How to dettach a Toplevel

Michael Lange klappnase at web.de
Tue Nov 28 22:26:02 CET 2006


On Tue, 28 Nov 2006 09:25:06 -0800 (PST)
Sorin Schwimmer <sxn02 at yahoo.com> wrote:

> Hi,
> 
> If I have:
> 
> <code>
> from Tkinter import *
> root=Tk()
> tl=Toplevel()
> root.mainloop()
> </code>
> 
> and then close the root window, it will take tl with it. Is there a way to keep tl alive after root dies?
> 

Hi Sorin,

maybe what you actually want is *two* Toplevels and *no* root:

from Tkinter import *
root = Tk()
root.withdraw()
t1 = Toplevel()
t2 = Toplevel()
root.mainloop()

I hope this helps

Michael


More information about the Tkinter-discuss mailing list