Getting the sender widget's name in function (Tkinter)

tiissa tiissa at nonfree.fr
Thu Apr 28 13:42:48 EDT 2005


Cameron Laird wrote:
> In article <opspvv1vyxrqur0o at eb.pragmadev>,
> Eric Brunel <eric_brunel at despammed.com> wrote:
> 
>>Unfortunately, making a binding to <Button-1> on Button widgets does not
>>have the same behavior as setting their 'command' option.
> 
> Without unraveling my own confusion about who has said what to whom, does
> everyone realize that Tkinter bind()ings inherently can access the widgets
> which generate their events?

I don't know about everyone, but I can assume that's definitively the 
case of infidel (who precisely based the solution you quoted on this) 
and Eric Brunel.

But that may not be the topic at hand. Indeed, the main point is that, 
according to Eric, bind() and command don't behave in the exact same way.

And the OP asked about having a reference on the widget using the 
command callback (that, contrary to event-binded callbacks, don't get 
passed any argument).


So far, the OP is proposed the choice to either use the event/bind 
mecanism or use different callbacks for his different buttons (either 
with the method I proposed or not).



More information about the Python-list mailing list