[pygtk] event handling

David M. Cook dave at davidcook.org
Sun Sep 3 15:19:44 WST 2006


On Sun, Sep 03, 2006 at 08:37:13AM +0200, Pascal DUCHATELLE wrote:
>          dic = {"on_mainWindow_destroy" : gtk.main_quit,
>                 "on_hello_key_press_event" : self.hellorecompile}
>  followed by this:
>          self.wTree.signal_autoconnect(dic)
>  Is there a way to use the second solution but also pass 
>  an argument like in the first one ?

You can use a tuple in your dic.  See

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.004.htp

Also, you can use a closure:

foo = 5
baz = 6
def my_handler(*args):
    print foo
    print baz
    
dic = {"some_handle" : my_handler}

Dave Cook


More information about the pygtk mailing list