so my problem is in this bit of program where I want to create "x" buttons (x is the length of a list), and each button has the name of the element in the list and calls the function "ChoicePage" with the name of the element as argument
example:
If I have a list like this [house, hospital, shop], the program creates 3 buttons: house, hospital and shop and they call ChoicePage(a) with a = "house", "hospital" or "shop"
 for i in range(len(L)):
        a = L[i]
        Button(fen1, text=a, relief=RAISED, command = lambda:(ChoicePage(a))).pack()
    fen1.mainloop()
the problem here is that it always calls ChoicePage with the last element of the list (in the previous example it would be "shop")
How can I fix this ?
 
     
    