By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,441 Members | 1,772 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,441 IT Pros & Developers. It's quick & easy.

Tkinter- New Window

P: n/a
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!

Nov 4 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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!

Nov 4 '05 #2

P: n/a
In article <11*********************@f14g2000cwb.googlegroups. com>,
Tuvas <tu*****@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 (je*@jes-2.demon.nl)

Nov 4 '05 #3

P: n/a
On Friday 04 November 2005 10:01, Tuvas wrote:
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/
Nov 4 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.