【发布时间】:2012-02-18 03:44:37
【问题描述】:
我的 IDE 中的 python shell 和 Tkinter 窗口之间存在问题。我想要做的是将我所有的用户输入都放在 shell 中,然后我想在 Tkinter 窗口中输出相应的信息。
但是,当我的窗口创建并弹出时,我关闭它以在 shell 中继续我的程序,然后我继续输入。但是,当我尝试重新初始化我的窗口时。它说窗户已被破坏。我理解这意味着什么,所以我尝试使用一个顶级窗口来输出我可以关闭的信息,并隐藏我的根窗口,但是在我关闭/销毁根窗口之前,shell 不会继续。
有没有一种方法可以在不破坏我的根窗口的情况下继续在 shell 中运行?我对这种语言相当陌生,因此非常感谢任何帮助。
这是我的总体思路:
from Tkinter import *
#get all my info from the shell
root = Tk()
root.withdraw() #hide the root window
main = Toplevel()
#this is the window that I want to be able to close and open later
#get more info from the shell after main is closed
#now I want to open the updated main window
提前致谢! (如果这很重要,我正在 Windows 上工作)
【问题讨论】:
标签: python shell window tkinter destroy