0

I'm trying to use pygame to render an environment in python. Globally, I've initialized pygame and the display with the lines:

pygame.init()
dis = pygame.display.set_mode((dis_width, dis_height))
pygame.display.set_caption('Snake Game Environment')

Then, inside the environment's render method, I begin by filling the environment with a black color with the line:

dis.fill(black)

When this method is first called, I get the error:

"pygame.error: display Surface quit"

I've tried colors other than black and get the same error. This problem only occurs when I call dis.fill inside the class's method.

  • Do the answers to this [question](https://stackoverflow.com/questions/1997710/pygame-error-display-surface-quit-why) help at all? – quamrana Apr 09 '22 at 17:56

1 Answers1

0

I've found out what the problem was. In another method of the class a "pygame.quit" method was being called causing the display to crash.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 11 '22 at 05:51