【发布时间】:2020-09-17 22:58:06
【问题描述】:
我使用 Tkinter 为我的语音助手 Python 脚本制作了一个 GUI。它工作得很好。但我想添加一个动画窗口来显示我使用 After Effects 创建的动画作为应用程序的介绍。我希望它在没有默认关闭(x)、最大化和最小化按钮的情况下打开。窗口应该一直停留到动画完成,然后它会消失。然后主窗口将正常打开以启动 GUI。为了禁用关闭、最大化和最小化按钮,我使用了root.overrideredirect(True) 方法。但是我不能像上面提到的那样一个接一个地同时打开两个窗口。如果有人能帮助我解决这个问题,我将非常感激!我已经在一个简单的 GUI 上使用代码对其进行了测试。我正在提供以下代码以帮助解决问题!
from tkinter import *
import time
root = Tk()
root.geometry('500x300')
root.overrideredirect(True) # To disable the default Window decoration
time.sleep(5) # Assuming that the animation runs for 5 seconds
root.destroy() # This window destroys after being on screen for 5 seconds
root.mainloop()
root2 = Tk() # After the previous window is destroyed, this window opens up. Assume that this is the main window
root2.geometry('500x300')
root.mainloop()
请帮帮我!
【问题讨论】:
标签: python windows user-interface tkinter