[pygtk] Callbacks

Peyman paskari007 at yahoo.ca
Wed Mar 11 20:17:59 WST 2009


Hi Walter

I realize that once you call connect() it returns the handle_id. But  
if glade is doing this for me, are the handle id's stored somewhere?  
Surely there has to be a widget.get_handle_id('callback_function')  
method. I can't seem to find anything on this over the net though.

Cheers


Peyman Askari

On 11 Mar 2009, at 07:56, Walter Leibbrandt wrote:

> 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