loops - Python message box showing without stopping script -


i have script create numbers randomly, between 5 , 55, in infinite loop. goal show message box when number 55 created. have try easygui, tkinter, ctypes,... , have been able create message box, when box appears loop stops , doesn't continue untill user clicks de ok button. there way show message box without stopping script?

i have been looking information in forums haven't found problem, hope can me.

this part of code loop:

 def contador():   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() 

messageboxes in cases (tkinter, gtk, winapi) modal windows. can create own dialog or can use threads.

import random tkinter import tk  def show_error(text):     top = toplevel(root)     label(top, text=text).pack()     button(top, text="ok", command=top.destroy).pack(pady=5)  def contador():     x in range(100):         aleatorio = random.randint(1,11)*5         if aleatorio == 55:             estado = "red"             show_error('some error occurred: %s' % x)         elif aleatorio >=30:             estado = "red"         else:             estado = "green"  contador() 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -