"Wayne Werner" <waynejwer...@gmail.com> wrote
def one_or_zero():
   x = 0
   while True:
       x = not x
       yield x

In case its not obvious how this iis used in a GUI context...

So for your exampler crweate a state variable somewhere in your GUI (x in Waynes example) and toggle its value from your button handler and return the result.

The easiest way to do that is to use a single function, like Wayne's, and call it from all of your handlers.

HTH

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to