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())

This code might put the statement in context:

# Create "Quit" button
   66           button = gtk.Button("Quit")
   67   
   68           # When the button is clicked, we call
the main_quit function
   69           # and the program exits
   70           button.connect("clicked", lambda w:
gtk.main_quit())
   71   
   72           # Insert the quit button into the both
lower quadrants of the table
   73           table.attach(button, 0, 2, 1, 2)
   74   
   75           button.show()

The complete script is located at
http://www.pygtk.org/pygtk2tutorial/sec-TablePackingExample.html.


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to