所以我想逃跑时间。睡觉()在另一个线程上,但调用该函数时整个程序仍然冻结。我用按钮叫它。这是为了创建一个错误,然后等待几秒钟来删除错误。不知道还能做什么。在
import threading, time
class Block():
def createError(self, text):
background.itemconfig(errorText, text=text, state=NORMAL, font="Neoteric 11 bold")
background.itemconfig(errorBG, state=NORMAL)
# Mainly this part to worry about
t = threading.Thread(target=self.removeError())
t.start()
print("Function called") # Only prints AFTER 5 seconds, even though removeError() should be running on another thread
def removeError(self):
time.sleep(5)
background.itemconfig(errorText, text="", state=HIDDEN)
background.itemconfig(errorBG, state=HIDDEN)
# Tkinter stuff here to create button and run createError()
任何想法都会很棒!在
我想出来了。我所要做的就是在线程内部使用不同的函数。在
交换: 在
收件人: 在
^{pr2}$就这样。工作起来很有魅力!在
相关问题 更多 >
编程相关推荐