Tk's default Toplevel - counterintuitive

Gary Herron gherron at aw.sgi.com
Thu Aug 19 19:02:29 EDT 1999


Stuart Reynolds wrote:
> 
> Does anyone know how to tell if Tk has already instaniated a Toplevel
> window? I want to be able to open several Toplevel windows in any order.
> 

Perhaps the easiest way is to never use the default top level window:

from Tkinter import *
DefaultTop = Tk()
DefaultTop.withdraw()  # Never to be seen 

def makeNewWindow():
   mstr = Toplevel()
   f = Frame(master=mstr)
   ...

You can still do
  DefaultTop.mainloop()
when it time to turn control over to the main event loop

-- 
Dr. Gary Herron <gherron at aw.sgi.com>
206-287-5616
Alias | Wavefront
1218 3rd Ave, Suite 800, Seattle WA 98101




More information about the Python-list mailing list