Why is the pygame window not closing properly?

When I go to close the program window, the program freezes and then I am forced to exit the program. Why the program does not close when you press the X / Close button. I also use python 2.7 if that matters.

import pygame
import os, sys
from itertools import *
from oryxsprites import *
from oryxbackground import *

running = True


while running:

    backgroundmain()
    pygame.display.set_caption('OryxGame')
    #pygame.display.set_icon(biggrasstile)

    for event in pygame.event.get():
         if event.type == pygame.QUIT:
             running = False
+5
source share
2 answers

Quote from an article in which the sports code is very similar to yours :

, "" True, ( X). , IDE Python, Pygame. , Pygame . , pygame.quit() .

+4

Python 3.2 pygame 1.9 win32, sys.exit() (. -). pygame.quit()

-1

All Articles