[pygtk] event handling
Brian
dol-sen at telus.net
Tue Sep 5 21:47:24 WST 2006
On Tue, 2006-05-09 at 14:02 +0200, Felix Rabe (public) wrote:
> Hi,
>
> You guessed, and it doesn't work. Maybe you use a special kind of Python, but with the standard one ...
>
It wasn't a guess, just faulty memory :(
> Brian wrote:
> > As a space separated list.
> >
> > dic = {"some_handle" : my_handler arg1 arg2,
> > "some_other_handle" : my_other_handler}
> >
>
> $ python
> >>> d = {"foo": 5 6 7}
^ did you redefine the number five to something else?
> File "<stdin>", line 1
> d = {"foo": 5 6 7}
> ^
> SyntaxError: invalid syntax
>
> ---
>
> Greetings,
> Felix
Anyway here is a portion of the Pygtk FAQ:
http://www.async.com.br/faq/pygtk/index.py?req=edit&file=faq22.004.htp
Here's an example where arguments other than the widget are passed to
the signal handler (note the tuple for handling clicks to the ok
button):
wTree2 = libglade.GladeXML("somefile.glade","proxy1")
proxywidget = wTree2.get_widget("proxy1")
id=1
dic= {"on_cancel_clicked": proxywidget.destroy,
"gtk_widget_destroy": proxywidget.destroy,
"on_ok_clicked": ( handle_ok_clicked, wTree2,id)}
wTree2.signal_autoconnect (dic)
Sorry for the bad advice the first time.
--
Brian <dol-sen at telus.net>
More information about the pygtk
mailing list