Tkinter allows you to assign a function to a button like this:
but = Button(master,text="Press Here",command=press_B1).pack()
where press_B1 is a defined function.
I have to take an array with n elements and create a button for each one element and if you press for example the first button it print the first element of array. It simple if I have a defined number of elements but with undefined elements I don't know how to do that.
If I have not explained well what I want to do:
arr = ["a","b","c"] #random number of elements
for i in range(len(array)):
but = Button(master,text="Press Here",command=?).pack()
At the end I should have 3 buttons and if I press the first one, python should print "a"