frames in toplevel Tkinter

J Wolfe vorticitywolfe at gmail.com
Thu Dec 17 11:26:44 EST 2009


On Dec 16, 11:09 pm, J Wolfe <vorticitywo... at gmail.com> wrote:
> Probably a stupid question, but can you have a frames in a toplevel
> widget? Anything I try to put in a frame goes back to the main or root
> widget and not the toplevel or pop-up widget.
>
> Thanks for the help!
> Jonathan

Thank you John,

from Tkinter import *
root = Tk()
Label(root, text='This is the root window').pack()
top = Toplevel(root)
fr = Frame(top)   # frame child of Toplevel called top
fr.pack()
Label(fr, text='This is in a frame in the Toplevel window').pack()
root.mainloop()

I swear I tried that about 20 times yesterday...and it kept putting it
in my main window.  Perhaps I had a naming issue.

Thanks!
Jonathan



More information about the Python-list mailing list