[pygtk] Signal Blocking

Shandy Brown sjbrown at vmware.com
Wed Nov 21 04:03:49 WST 2007


I'm trying to write a clock widget.  I want it to look nice and to
behave in a friendly manner.

* It should show colons between the hours, minutes, and seconds
* typing the time should "skip" over the colons

I've tried to implement this by 5 sequential text entry widgets, each
without a frame so they look like they're part of the same widget, laid
out like this:

+----+---+----+---+----+
| hh | : | mm | : | ss |
+----+---+----+---+----+

if the time is 10:20, I want focus to default to the hours, and the user
can type in "1020".

The best way I can think of doing this is by detecting that on the
keypress for "2", the number is out of bounds, then blocking the signals
for the minute text entry, and setting it's value to 2.

However, sometimes when I try to block the signals, I get the message 

 Warning: gsignal.c:1695: instance `0xaf6800' has no handler with id `115'

Which doesn't make sense to me, because I 115 definitely exists, as I
stored it previously.

I've attached the code which will exhibit the behaviour.  Just type
"python clock.py"

Any suggestions?  Anyone know why signal 115 disappears?

-sjbrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clock.py
Type: text/x-python
Size: 21430 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20071120/be29ed32/clock.py


More information about the pygtk mailing list