Python Forum
Unable to exit Pygame window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to exit Pygame window
#2
sys.exit will not close the pygame window. You have to use pygame.quit but I'd also suggest making the code more like this.
while not gameOver:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            gameOver=True
pygame.quit()
sys.exit()
This way it will run through everything and then close out everything as well. Since your new to pygame I'd suggest looking at the tutorial here on this forum. Just go to the tutorial section from the main page --> Game Tutorials --> and there's an entire series for learning pygame by metulburr
Reply


Messages In This Thread
Unable to exit Pygame window - by Hesper - Mar-27-2020, 12:11 PM
RE: Unable to exit Pygame window - by SheeppOSU - Mar-27-2020, 05:19 PM
RE: Unable to exit Pygame window - by Hesper - Mar-30-2020, 08:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Cannot display anything inside pygame window the_gullwing 5 1,291 Dec-07-2023, 02:44 AM
Last Post: Benixon
  [PyGame] drawing images onto pygame window djwilson0495 1 3,542 Feb-22-2021, 05:39 PM
Last Post: nilamo
  pygame get window position vskarica 3 6,016 Oct-18-2020, 05:14 PM
Last Post: nilamo
  [pyGame] More Text in one Window, example needed ! JamieVanCadsand 1 3,595 Oct-03-2017, 03:42 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020