On Wed, 12 Jul 2006 06:48:44 -0500 Luke Paireepinart <[EMAIL PROTECTED]> wrote:
> For example, in Tkinter, you can bind buttons to function calls, but you > can't have buttons pass arguments to the functions. So you have to > somehow make a separate function for each button, or do some weird > backend event handling stuff that you can look up if you're really > interested. BTW, that is not really true: >>> from Tkinter import * >>> def test(*args): ... print args ... >>> root = Tk() >>> b = Button(root, text='Hi', command=lambda widget=b: test(widget)) >>> b.pack() Now when you press the button, you get: >>> (<Tkinter.Button instance at 0xb78a478c>,) >>> so the callback actually "knows" which widget called it, and you could easily perform different actions for several buttons. I know that is not what this thread is about, I just could not resist... Michael _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor