pygame.error: video system not initialized
if event.type == pygame.quit():
In the line above, you're calling pygame.quit()
which is a function, while what you really want is the constant pygame.QUIT
. By calling pygame.quit()
, pygame is no longer initialized, which is why you get that error.
Thus, changing the line to:
if event.type == pygame.QUIT: # Note the capitalization
Will solve your problem.
It's important to note that pygame.quit()
will not exit the program.