[pygtk] check button state continuously
skip at pobox.com
skip at pobox.com
Fri Sep 29 21:54:21 WST 2006
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
More information about the pygtk
mailing list