[Tutor] Alternate button hit problem in tkinter

Wayne Werner waynejwerner at gmail.com
Tue Feb 1 22:34:11 CET 2011


On Tue, Feb 1, 2011 at 3:24 PM, ANKUR AGGARWAL <coolankur2006 at gmail.com>wrote:

> Hey
> I am developing a zero-cross game from the basics of the tkinter. I want
> something like this-
>
> We have 4 buttons like 1 2 3 4
> i want the output should change on the alternate button hit. Like inorder i
> hit-
> Button  return
> 1              1
> 3               0
> 2               1
> 4               0
>
> Basically i want to change the output of the button alternatively. like for
> example take this scenario-
>
> Button   return
> 2             1
> 4              0
> 1              1
> 3               0
>
> It depends on the user which button it hits first but i want the output to
> be different for alternate button pick.
> i tried to think upon this very much but unable to finally come up with any
> idea. Cn anyone suggest me a way out.
> Thanks in Advance.
> Ankur Aggarwal
>

def one_or_zero():
    x = 0
    while True:
        x = not x
        yield x

Something like that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110201/ac9b6fa1/attachment-0001.html>


More information about the Tutor mailing list