Tkinter- New Window

Jim Segrave jes at nl.demon.net
Fri Nov 4 14:24:58 EST 2005


In article <1131126422.958411.66860 at f14g2000cwb.googlegroups.com>,
Tuvas <tuvas21 at gmail.com> wrote:
>Is there a way to make a new window pop up using Tkinter? I have some
>functions that require more data in my interface than I have space for,
>and would like to be able to pop up a new window to request this
>information. Thanks!

Dialogue boxes pop up new windows for gathering information. If you
want a more permanent second window, then the Toplevel() widget is
like a frame, but is a separte window with window manager
decorations, can be sparately iconfied etc.

from Tkinter import *
root = Tk()
root.title('Root')
rootlabel = Label(root, text = 'This is the root window', relief = RIDGE)
rootlabel.pack(side = TOP, fill = BOTH, expand = YES)
other = Toplevel()
other.title('Second Window')
otherlabel = Label(other, text = 'This is the other window', relief = RIDGE)
otherlabel.pack(side = TOP, fill = BOTH, expand = YES)
root.mainloop()



-- 
Jim Segrave           (jes at jes-2.demon.nl)




More information about the Python-list mailing list