Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pygame missing init line 3 and after quit event sys.exit() call #4

Open
takonkle opened this issue Aug 25, 2021 · 1 comment
Open

Comments

@takonkle
Copy link

Using code as is had "pygame.error: video system not initialized" upon window close
Pygame tutorial website says to add (before line 3):
pygame.init()
So that all modules are initialed... May or not be an issue.

in main() after one detects exit event, for loop is left to keep looking for events even though pygame.quit() is called, thus after line with pygame.quit() add:
sys.exit()
and perhaps import sys module in first line.

Summary of changes:

  • add "sys, " in front of "pygame" line 1
  • insert before line 3 "pygame.init()"
  • in main() for loop, after line with "pygame.quit()", add line with "sys.exit()" to not only break for loop and main but exit and not use anything in pygame modules, etc.
@Tomasu-99
Copy link

I did this but now nothing comes up on the screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants