【发布时间】:2015-09-07 08:47:01
【问题描述】:
在尝试使用 EasyGUI 制作游戏后,我发现它不会做一些对游戏很重要的事情,所以我开始使用 Tkinter。但是我遇到了另一个我不知道如何解决的问题。代码如下:
money = Button(box2, text = "Get Money", highlightbackground = "yellow", command = close_parentg)
def moneywindow():
parent.destroy() # The button is inside the parent.
Money.mainloop() # This is the window I want to open.
destroy() 命令工作正常,因为当我按下按钮时第一个窗口关闭,但如果我运行程序,第二个窗口会弹出,即使我没有告诉它(或者我至少认为我没有)。
如何阻止第二个窗口在开始时弹出并仅在我单击按钮时显示?
【问题讨论】:
-
您需要显示更多的代码,您能否提供一个minimal reproducible example 来重现您的问题?
-
如果我运行程序是什么意思?程序不是已经运行了吗?