0

pygame window |code

I'm currently making a sudoku solver. I have designed the grid in the pygame window however this is not an actual pygame grid its a drawn background with drawn numbers backed by a 2d array, I need the user to be able to click on a cell and then press any key 1-9, the value will then be stored in a variable which will eventually update the corresponding array position, in the image I have provided, the line which prints the variable clicked_cell runs perfectly fine however when I press a key nothing happens, I don't get an error message its as if the compiler is skipping it could anyone help me? @Gooberton do you see the image of the 9x9 grid. i also put the code as an image i think that got flagged so i just wanna know if both images are still there if not i can upload the cod in a different tab

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
Am 2_20
  • 9
  • 3

1 Answers1

-1

You could try putting a print() in the function to see if it is actually running. If it prints something, then the problem is with the part where you set the variable. Are you refreshing the window after updating the value? If not, you'll need to do that otherwise it won't show up. I also suggest clearing the screen before adding anything to it so there isn't any overlap with the numbers that would make them difficult to read. Also there isn't an image there. Is that intentional?

Gooberton
  • 17
  • 7