Quoting Ron Weidner <[EMAIL PROTECTED]>:
> Or, more to the point... I need to dynamicaly create
> clickable labels, each using the same callback. When
> clicked, I need to know which one was clicked. I was
> hoping to use the "text" of the label as the argument
> to another function.
You've got one suggestion ... But, FWIW, here is how I would probably do it:
def clicked(w):
print 'Widget %s clicked! Text:' % (str(w), w.cget('text'))
def makeCallback(w):
def callback(e):
clicked(w)
return callback
# create labels
for text in ['foo', 'bar', 'baz']:
lb = Label(master, text=text)
lb.bind('<Button-1>', makeCallback(lb))
--------------
(this involves a separate callback function for each label, so it could possibly
be slower)
--
John.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor