Tkinter container frames

Ron Provost ron.longo at cox.net
Sat Dec 1 21:41:48 EST 2007


I've been trying to figure out how to use the container option in a frame widget in conjunction with the use option with a Toplevel widget.  Which according to the documentation I've read sounds like it will give me a Windows MDI like application with free-floating child windows within the container widget.  Has anyone successfully used this feature?  Here's the code I've been playing with.

Thanks for any help.



import Tkinter as Tk


tkRoot = Tk.Tk( )
f = Tk.Frame( tkRoot, container=True )
f.pack( )

t1 = Tk.Toplevel( use=f )
b1  = Tk.Button( t1, text="Pres me" )
b1.pack( )

t2 = Tk.Toplevel( use=f )
b2  = Tk.Button( t2, text="No pres me!" )
b2.pack( )


tkRoot.mainloop( )

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071201/1c9551f4/attachment.html>


More information about the Python-list mailing list