I'm trying to do one of the projects in the Python Crash Course book: Alien Invasion Chapter 12. I just started and for some reason the error: pygame.error: video system not initialized
keeps popping up. I'm pretty sure I followed the directions appropriately so I don't know what I have possibly done wrong...?
import sys
import pygame
from settings import Settings
def run_game():
pygame.init()
ai_settings = Settings()
screen = pygame.display.set_mode(
(ai_settings.screen_width, ai_settings.screen_height))
pygame.display.set_caption('Alien Invasion')
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
screen.fill(ai_settings.bg_color)
pygame.quit()
sys.exit()
pygame.display.flip()
run_game()