closing a widget

Discussion in 'Python' started by Marcus Schneider, Aug 17, 2003.

  1. Normally I close my windows/widgets with destroy and it works fine.
    Now I have a window (let's call it 1) from where I open an additional
    window (let's call it 2). I close it.
    Each window has its own main loop.
    Now I want to open another window outside the mainloop of window 1. So
    I quit that mainloop, go to a new window, destroy that, enter the
    mainloop of window 1 again and finally exit with destroy.

    All this works in princial, but here's the funny behaviour:

    1) If I don't enter 2 quit works, if I do enter 2, I have to press the
    "quit button" 2 times. Actually I have to press it an additional time
    for every time I opened the window 2. What is happening? How can I
    stop that???

    2) For whatever reason I also have to click two times on the "destroy"
    button at the end of the example. The destroy command is only executed
    the second time I press the button ???!!!

    All the widgest/windows are stand alone object and use their own
    variables..
     
    Marcus Schneider, Aug 17, 2003
    #1
    1. Advertising

  2. in the meantime I found a work around, but "there is only one
    mainloop" confuses ME ;)

    When I generate a GUI with page, the function to open the window looks
    like:

    def vp_start_gui():
    global w
    global root
    root = Tix.Tk()
    root.title('xyz')
    w = Klassenname (root)
    init()
    root.mainloop()

    If I use for different windows different variables (like root1, root2
    etc) and use commands like "root1.mainloop" and "root2.mainloop",
    shouldn't I get one mainloop per window?

    Regarding your questions:
    I open the new windows rather independently in the same way as
    described above.
    I close windows based on a button pressed.
    With quitting a windows I refer to the quit method.

    Hope that clearifies it to a certain degree;)


    "Michael Peuser" <> wrote in message news:<bhpre9$pgv$03$-online.com>...
    > "Marcus Schneider" <> schrieb im Newsbeitrag
    > news:...
    > > Normally I close my windows/widgets with destroy and it works fine.
    > > Now I have a window (let's call it 1) from where I open an additional
    > > window (let's call it 2).

    >
    > Do you mean you make (1) the basis of a Toplevel (2) ?
    > > I close it.

    >
    > (2) ? By a button created on that Toplevel ?
    >
    > > Each window has its own main loop.

    >
    > There can only be one mainloop. No idea what happens, when you call mainloop
    > during in an event-routine. Never do it!
    >
    > > Now I want to open another window outside the mainloop of window 1.

    >
    > What do you mean by this?
    >
    > > So
    > > I quit that mainloop.

    >
    > How can you do that? What at all do you mean by "mainloop"? Tkinter.mainloop
    > I presume?
    >
    > > go to

    >
    > GOTO?
    >
    > > a new window, destroy that, enter the
    > > mainloop of window 1 again and finally exit with destroy.
    > >
    > > All this works in princial....

    >
    > This is a surprises to me...
    > My be I really do not understand what you are doing.....
    >
    > Kindly
    > Michael P.
    >
    > [....]
     
    Marcus Schneider, Aug 18, 2003
    #2
    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?Vk1J?=

    Closing popup window when closing parent window?

    =?Utf-8?B?Vk1J?=, Feb 14, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    674
    Thomas Hansen
    Feb 15, 2007
  2. Replies:
    0
    Views:
    351
  3. Frederic Rentsch
    Replies:
    0
    Views:
    272
    Frederic Rentsch
    Jul 8, 2012
  4. Terry Reedy
    Replies:
    15
    Views:
    670
    Frederic Rentsch
    Jul 16, 2012
  5. Frederic Rentsch
    Replies:
    0
    Views:
    461
    Frederic Rentsch
    Jul 9, 2012
Loading...

Share This Page