I created a grid of buttons using loops.
for i in range(600//25):
for j in range(1000//25):
btns = Button(frame_main , height = 1 , width = 2 , bg = "grey" , command = lambda : clicked(btns , check))
btns.grid(row = i , column = j)
And I can't seem to add an event to each individual button, it only adds it to the last instance of it, which makes sense, but I don't know how I can reference each and every button individually.
This is the code for the function. It's not complete, but I'm just trying to get the first part to work for each individual button first.
check = 0
def clicked(obj , check):
if selection_var.get() == 2 :
if check != 0 :
messagebox.showerror("Error","You have already selected a start point")
else :
check += 1
obj.config(bg = "green")