I want to make 5 buttons in a loop, and for each buttons bind a commend to print the index. In the following solution it always prints the same index.
My code like this:
for i in range(5):
make_button = Tkinter.Button(frame, text ="make!",
command= lambda: makeId(i))
def makeId(i):
print(i)
It always prints 5. How can I fix this?