I want to have a grid, which I can modify before the start of the simulation, but I can't make buttons which use a function again after clicking.
Snippet:
def click_update(index):
status[index] = abs(status[index] - 1)
btn[index].config(bg=btn_color(status[index]))
for i in range(2500):
files.append("button"+str(1+1)) #<--add plus 1
for i in range(len(files)):
status.append(0) #<--remove int
btn[i].grid(row=int(i//50),column=i%50,sticky="we") #<== remove int from column keyword
for i in range(len(files)):
btn[i].config(bg=btn_color(status[i]), command=lambda index=i: click_update(index))
btn.append(Button)
Screenshot:
On the screenshot, you will see either black nor white when clicking