Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a window that was hidden using "withdraw" method?

I would like to show a window after I called withdraw.

The following is my current code:

from Tkinter import *

def callback():    
    global root
    root.withdraw()
    win2 = Tk()

root = Tk()
Label(root,text='this is a window').pack()
Button(root,text='withdraw',command=self.callback).pack()
mainloop()

As soon as I press the button, the window disappears much as I want it, and another window appears and everything works great. How do I get the first window back, in the same state as it was before?

like image 611
IcyFlame Avatar asked Apr 12 '13 09:04

IcyFlame


1 Answers

Use the following commands when you want to show the window:

# root.update()  # not required
root.deiconify()

If you want to know more about it, see here.

like image 52
IcyFlame Avatar answered Oct 11 '22 13:10

IcyFlame