On Mon, 2006-04-09 at 12:42 +0200, Pascal DUCHATELLE wrote:
> 
> 
> "David M. Cook" <[EMAIL PROTECTED]> a écrit :
>         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
>         _______________________________________________
>         pygtk mailing list pygtk@daa.com.au
>         http://www.daa.com.au/mailman/listinfo/pygtk
>         Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> Hi Dave,
> I will turn my question differently: in your answer your my_handler
> accepts keywords. Then how do you pass them to your my_handler in the
> dic since using a coma as separator is considered to be followed by
> the next dic key-entry pair. Maybe I'm wrong. Or is a tuple or a list
> OK as an entry in such a dictionary ?
> Thank you
> Pascal
> 
> 
As a space separated list.

dic = {"some_handle" : my_handler arg1 arg2,
       "some_other_handle" : my_other_handler}

-- 
Brian <[EMAIL PROTECTED]>

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to