In Python, you would probably create a list of buttons. What you can
do is assign the button number to an instance attribute of each
button, e.g. (untested, but you get the gist):
buttons = []
for i in range(5):
buttons[i] = b = Button(master, {'text': `i`, 'command': b_callback})
b.my_number = i
I believe the callback function receives its widget as a parameter so
the b_callback function will be able to figure out its button number.
--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>