Tkinter- New Window

Discussion in 'Python' started by Tuvas, Nov 4, 2005.

  1. Tuvas

    Tuvas Guest

    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!
    Tuvas, Nov 4, 2005
    #1
    1. Advertising

  2. Tuvas

    Tuvas Guest

    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!
    Tuvas, Nov 4, 2005
    #2
    1. Advertising

  3. Tuvas

    Jim Segrave Guest

    In article <>,
    Tuvas <> 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 ()
    Jim Segrave, Nov 4, 2005
    #3
  4. Tuvas

    James Stroud Guest

    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/
    James Stroud, Nov 4, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Tm92aWNl?=
    Replies:
    2
    Views:
    6,619
    Alan Ferrandiz Langley
    Jun 9, 2004
  2. Matt
    Replies:
    2
    Views:
    13,912
    bruce barker
    Aug 23, 2004
  3. Matt
    Replies:
    1
    Views:
    410
    Andrew Thompson
    Aug 22, 2004
  4. Matt
    Replies:
    5
    Views:
    3,025
    Michael Winter
    Aug 25, 2004
  5. Clara
    Replies:
    6
    Views:
    574
    Clara
    Apr 25, 2005
Loading...

Share This Page