Skip to content Skip to sidebar Skip to footer

Pygame Window Closes Immediatly After Opening Up

import pygame #initialize the screen pygame.init() #create the screen screen = pygame.display.set_mode((80, 600)) #tile and icon pygame.display.set_caption('Space Invaders') icon

Solution 1:

pygame.quit() invokes the quit method and uninitialize all pygame modules. You have to evaluate if the event type attribute is equal the constant pygame.QUIT (see pygame.event):

if event.type == pygame.quit():

if event.type == pygame.QUIT:

Post a Comment for "Pygame Window Closes Immediatly After Opening Up"