Re: [Tutor] lambda and creating GUIs

2006-06-17 Thread Alan Gauld
>I understand this: >> >> def f(w): gtk.main_quit() >> button.connect("clicked", f) >> > > Now my question is what is "w"? What is being passed > to the function? That will be defined by GTk. The framework will define what each of its event hamdler callback functions looks like in terms of p

Re: [Tutor] lambda and creating GUIs

2006-06-16 Thread John Fouhy
On 17/06/06, Christopher Spears <[EMAIL PROTECTED]> wrote: > I understand this: > > > > def f(w): gtk.main_quit() > > button.connect("clicked", f) > > > Now my question is what is "w"? What is being passed > to the function? I don't know GTK, but I would guess some kind of event class. Other GUI

Re: [Tutor] lambda and creating GUIs

2006-06-16 Thread Christopher Spears
I understand this: > > def f(w): gtk.main_quit() > button.connect("clicked", f) > > lambda simply saves cluttering up the code with lots > of tiny function > derfinitions which are never referred to apart from > in the binding > operation. > Now my question is what is "w"? What is being passe

Re: [Tutor] lambda and creating GUIs

2006-06-16 Thread Alan Gauld
>I have been reading though the PyGTK tutorial. > Can anyone explain how lambda is being used in this > statement: > > button.connect("clicked", lambda w: gtk.main_quit()) lambda is being used to create an anonymous function. The code could be rewritten like this: def f(w): gtk.main_quit() butto

Re: [Tutor] lambda and creating GUIs

2006-06-15 Thread John Fouhy
(resending to include Tutor -- sorry for the dupe, Christopher) On 16/06/06, Christopher Spears <[EMAIL PROTECTED]> wrote: > I have been reading though the PyGTK tutorial. > Can anyone explain how lambda is being used in this > statement: > > button.connect("clicked", lambda w: gtk.main_quit())