Python Forum
[PyGame] PyGame does not close when I press the close button
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] PyGame does not close when I press the close button
#2
you should never use sys.quit to exit a program. You should let the program run to the end of the script. Your problem is you need pygame.quit() if i recall in combo with IDLE to quit properly.

running = True

while running:
...
   if event.type == pygame.QUIT:
      running = False
and then at the very end of the script put
pygame.quit()
Recommended Tutorials:
Reply


Messages In This Thread
RE: PyGame does not close when I press the close button - by metulburr - May-25-2018, 05:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  cant make a door automatically close a few seconds after i open it in pygame cooImanreebro 2 2,296 Dec-15-2020, 08:40 PM
Last Post: michael1789
  PyGame: detecting key press, but not key qrani 2 4,036 Sep-28-2018, 11:08 PM
Last Post: qrani

Forum Jump:

User Panel Messages

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