Kai Weber wrote:
This illustrates connection to two different types of signal handlers: one user defined, the other a Window method. The button callback passes two args to the callback function but the Window destroy() method only takes one; the lambda function mediates between these.distribution to use as an example in the tutorial. Please let me know if you have suggestions or find errors in the tutorial.
I try learning pygtk with your nice tutorial. I have a question regarding the helloworld.py example.
What is the reason to connect the "clicked" event on the button directly to the window's destroy function? self.button.connect("clicked", lambda wid,win: win.destroy(), self.window)
There is already an defined destroy-callback function which can be used easy
self.button.connect("clicked", self.destroy)
Or is this just there for learning purposes? Besides that I do not
understand your explanation why we need a lambda function there.
A better way to do this is to use the connect_object() method:
self.button.connect("clicked", gtk.Widget.destroy, self.window)
which replaces the Button object in the callback with the Window object.
Thanks for the feedback Kai. I'll change the tutorial to use the connect_object() method.
John
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/