first of all, sorry for the title, I couldn\'t find a better one.
The following code is a minimalized version of a problem I have in my Python program (I am a newbie btw
Use default parameter to avoid late-binding issue (Otherwise i
is bound when the lambda function is called, not when it is created):
def start():
buttons = []
win = Tkinter.Tk()
for i in range(5):
b = Tkinter.Button(win, height=10, width=100, command=lambda i=i: onClick(i))
b.pack()
buttons.append(b)