[pygtk] Callbacks
Walter Leibbrandt
walter at translate.org.za
Wed Mar 11 16:56:51 WST 2009
Hi,
Peyman wrote:
> Hello
>
> Is there a clean way to temporarily cancel callbacks? For example
> consider a combobox CB1 with the following callback function
>
> on_CB1_changed(...):
> someVar= the new entry
>
> now if I manually change the combobox to, for example "Select item", I
> don't want the changed signal to be generated since I don't want
> someVar to be set to "Select item".
>
To temporarily block specific signal handlers from running, you can use
the GObject.handler_block() and GObject.handler_unblock() methods
(http://www.pygtk.org/docs/pygobject/class-gobject.html#method-gobject--handler-block),
because all widgets (and most of the classes in the gtk module)
sub-class gobject. The "handler_id" mentioned there is the integer value
returned by the original connect() call.
HTH
--
Walter Leibbrandt http://translate.org.za/blogs/walter
Software Developer +27 12 460 1095 (w)
Translate.org.za
Recent blogs:
* Firefox-style button with a pop-up menu
http://www.translate.org.za/blogs/walter/en/content/firefox-style-button-pop-menu
* Virtaal's MVCisation
* Things that changed the way I code
More information about the pygtk
mailing list