On Fri, 15 Jul 2005 23:29:22 +1200 (NZST)
[EMAIL PROTECTED] wrote:
> Quoting Michael Lange <[EMAIL PROTECTED]>:
>
> > I don't think it will work this way, because you don't catch the event
> > bind() passes to the callback
> > (you also use a variable "e" in makeCallback() that isn't defined
> > anywhere).
>
> That's what the variable 'e' is doing!
>
> Here is some code I just wrote and tested:
>
> >>> def clicked(w):
> ... print 'Widget %s clicked! Text: %s' % (str(w), w.cget('text'))
> ...
> >>> def makeCallback(w):
> ... def callback(e):
> ... clicked(w)
> ... return callback
> ...
Aah, you're right, I guess I got confused a little.
Still I think it's overly complicated in this context, when you can you get the
same result with:
def makeCallback(event):
print "Widget %s clicked! Text %s" % (str(event.widget),
event.widget['text'])
Regards
Michael
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor