如何显示使用“撤销"隐藏的窗口方法? [英] How to show a window that was hidden using "withdraw" method?

查看:51
本文介绍了如何显示使用“撤销"隐藏的窗口方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在调用 withdraw 后显示一个窗口.

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

以下是我当前的代码:

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?

推荐答案

想要显示窗口时使用以下命令:

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.

这篇关于如何显示使用“撤销"隐藏的窗口方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆