Question

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)
Était-ce utile?

La solution

Oh, I got. When I tried to 'getsomething', it had to wait a bit because it had some delay which prompted was returning a string like 'wait, getting info'.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top