Ok, so I have this code that generates a grid of buttons:
def click():
squares[-1][y].configure(bg='blue')
def game(width,height):
global squares
squares = []
global y
for x in range(width):
squares.append([0] * height)
for y in range(height):
squares[-1][y] = Button(gameWindow,command=click)
squares[-1][y].grid(column = x, row = (y + 1), sticky =(N+S+E+W))
for x in range(width):
Grid.columnconfigure(gameWindow, x, weight = 1)
for y in range(height):
Grid.rowconfigure(gameWindow, (y + 1), weight = 1)
gameWindow.mainloop()
game(8,8)
I can configure a specific button (1,1) by doing this:
squares[1][1].configure(bg='blue')
But when I try to configure a button when it is used, it changes the button in the bottom right.
Any help would be greatly appreciated, thanks in advance.