At the moment I create a Visualization Tool for my Sudoku solver.
Now I want to display the numbers in the grid with pygame.
def draw(win):
global grid
w = 70
x,y = 0,0
for row in grid:
for col in grid:
rect = pygame.Rect(x,y,w,w)
pygame.draw.rect(win,BLACK,rect)
rect2 = pygame.Rect(x+2, y+2, w-1, w-1)
pygame.draw.rect(win,WHITE,rect2)
pygame.display.flip()
x = x + w
y = y + w
x = 0
The code is ugly, I know but my grid works. And I can iterate over it. My problem now, I don't know how to fill the Rect with a Number?
I want to add the Number from the Sudoku grid at the position [row][col] within rect2.
I hope one of you guys can help me.