What is the difference between .quit and .QUIT in pygame

QUIT is the enumerator constant for an event type (see event module). The quit event occurs when the pygame window is closed:

for event in pygame.event.get():
    if event.type == pygame.QUIT:
        # [...]

quit() is a function which uninitialize all pygame modules. This function should be called at the end of the applicaiition:

# initialize all imported pygame modules
pygame.init()

# application loop
while True:
    # [...]

# uninitialize all pygame modules
pygame.quit()

Leave a Comment