mardi 22 avril 2014

Why does this runs twice?


Vote count:

1




I made a program which runs using the SysTrayIcon


And even thou it works just fine, every time it checks something, it does it twice. I can fix it by reducing the chance by half, but that's a shortcut not a proper fix.



from systray import SysTrayIcon
from random import randint


def shutprogram(SysTrayIcon):
something = getsomething()
while True:
if getsomething() != something :
something = 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)


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire