Tkinter- New Window

T

Tuvas

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!
 
T

Tuvas

Okay, never mind about my first question, I got that answer by using
Toplevel. However, there' s still a question to be answered.

I popped up this new window with the intent to have something like
this:

"what is your question"
____________________
<Button to close>

Ei, there's a question popped up, a label that gathers information, and
a button that will close it. However, I can't get the button to close
it, it keeps saying that the variable isn't defined. I haven't even
tried to get it to read the value of the label, but I think that it
will be a similar type problem. Any nice ways around this problem? I do
want these values only to be called when the function is called. Thanks!
 
J

Jim Segrave

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()
 
J

James Stroud

Okay, never mind about my first question, I got that answer by using
Toplevel. However, there' s still a question to be answered.

I popped up this new window with the intent to have something like
this:

"what is your question"
____________________
<Button to close>

Ei, there's a question popped up, a label that gathers information, and
a button that will close it. However, I can't get the button to close
it, it keeps saying that the variable isn't defined. I haven't even
tried to get it to read the value of the label, but I think that it
will be a similar type problem. Any nice ways around this problem? I do
want these values only to be called when the function is called. Thanks!

Looks like you are reinventing the wheel. Check out the tkMessageBox module.

James


--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,269
Messages
2,571,338
Members
48,029
Latest member
Anchorman2022

Latest Threads

Top