在tkinter中使用After

问题描述

我在tkinter中使用.after时遇到问题,time.sleep也不起作用。我想要的是它显示一个WORD 5秒钟,单词清除,然后出现一个条目。无需使用.after即可正常运行,但是现在卡住了5秒钟,随机WORD有时会作为Entry出现。

我还没有弄清这个词的含义:-)我是编程和python的新手,任何建议都值得赞赏。谢谢!

for widget in window.winfo_children():
            widget.destroy()
WORD = random.choice(VOCABULARY)
tk.Label (window,image=photo1,bg="black") .grid(row=0,column=0)
tk.Label (window,text = "{}".format(WORD),bg="black",fg="white",font="none 20 bold") .grid(row=1,column=0)
window.after(5000)
ANSWER = tk.Entry(window,width=20,bg="white")
ANSWER.grid(row=2,column=0)
tk.Button(window,text="Check",width=6,command=check) .grid(row=3,column=0)
WORDS_PASSED.append("{}".format(WORD))
VOCABULARY.remove("{}".format(WORD))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)