python 2.7 - Why does this runs twice? -


i made program runs using systrayicon

and thou works fine, every time checks something, twice. can fix reducing chance half, that's shortcut not proper fix.

from systray import systrayicon random import randint   def shutprogram(systrayicon):     = getsomething()     while true:         if getsomething() != :             = getsomething()             if randint(0,100) <= 10:                 print "stop, hammer time!"                 stopthis()             else:                 print "you may pass"  menu = (('start', icon.next(), shutprogram),)  systrayicon(icon.next(),"shut program",menu) 

oh, got. when tried 'getsomething', had wait bit because had delay prompted returning string 'wait, getting info'.


Comments

Popular posts from this blog

c - ALSA programming: how to stop immediately -

c++ - How to add Crypto++ library to Qt project -