tkinter: identifying callback button?

Lewis Doug at news.vex.net
Wed Sep 8 23:49:10 EDT 1999


I have a bunch of (named) buttons which call the same callback.
I've been trying to figure out how (or if) I can get the callback
function to be able to identify which one.

For example....

    for x in range(0,5):
        b = Button(frame,text='#%s' % x,command=self.xxx, name='b%s' % x)
        b.pack()

So one of the five buttons gets pressed and calls App.xxx(self) ...
but can App.xxx figure out which button triggered the command? 

I could save the button references in a list, but don't know if that
would help.








More information about the Python-list mailing list