我有一个脚本,可以在一个无限循环中随机创建5到55个数字。我的目标是在创建数字55时显示一个消息框。我试过easygui,tkinter,ctypes,。。。我已经能够创建消息框,但是当这个框出现时,循环停止,直到用户单击deok按钮才会继续。有没有办法在不停止脚本的情况下显示消息框?在
我一直在论坛上寻找信息,但我没有找到有这个问题的人,所以我希望有人能帮助我。在
这是包含循环的代码部分:
def contador():
for x in range(1):
aleatorio = random.randint(1,11)*5
if aleatorio ==55:
estado = "Red"
ctypes.windll.user32.MessageBoxW(0, u"Error", u"Error", 0)
elif aleatorio >=30:
estado = "Red"
else:
estado = "Green"
global t
t = threading.Timer(15.0, contador)
t.start()
t = threading.Timer(15.0, contador)
t.start()
大多数情况下(tkinter、gtk、winapi)消息框都是模式窗口。您可以创建自己的对话框,也可以使用线程。在
相关问题 更多 >
编程相关推荐