[pygtk] check button state continuously

Steve McClure sMcClure at racemi.com
Fri Sep 29 22:04:18 WST 2006


On Fri, 2006-09-29 at 08:54 -0500, skip at pobox.com wrote:
>     Karsten> But because the move_robot function is critical, i wanted to
>     Karsten> have some security if the release event got lost.
> 
> It doesn't appear the Button widget exposes its pressed state via
> properties.  I think you'll just have to assume the released signal is sent
> and caught.  If there was you could recast move_robot as
> 
>     def move_robot(self):
>         # do a little dance ...
>         # make a little love ...
>         # get down tonight!
>         # get down tonight!
>         if self.move_button.state_is_pressed():
>             return False
>         return True
> 
> (The "return True" was missing from the first version.  Without it, the
> timer will be cancelled after the first call.  I was too intent on the "do a
> little dance" comments I guess.)
> 
> Skip

And you can probably reasonably assume that if for whatever reason the
event was "missed" the button state would never be updated anyway as the
network is still the transport for that activity too.

> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure                                     Racemi
email: smcclure at racemi.com                        380 Interstate North Pkwy, SE
voice: 404-892-5850                               Suite 250
fax: 404-892-7215                                 Atlanta, GA 30339
                                                  http://www.racemi.com



More information about the pygtk mailing list