例如,我正在创建一个Python程序,我想移到另一个屏幕,然后出现“返回”按钮,但会有延迟。我以为可以,但是... GUI冻结了!我没有找到有关此错误的信息。 我的代码是:
from tkinter import *
root = Tk()
root.geometry('300x300')
button1 = Button(text = 'Next', command = lambda: next_screen())
second_screen = Frame(root, width = 300, height = 300, bg = 'black')
back_button = Button(second_screen, text = 'Back')
button1.place(x = 0, y = 0)
def next_screen():
button1.place_forget
second_screen.place(x = 0, y = 0)
sleep = 100
root.after(5000, btn_back_sleep.place(x = 25, y = 200))
root.mainloop()
您不知道正确的解决方案吗?请帮助