0

code:

from signal import pause
import sys
import pygame
def run_game():
    # Initialize game and create a screen object.
    pygame.init()
    screen = pygame.display.set_mode((1200, 800))
    pygame.display.set_caption("Alien Invasion")
    # Start the main loop for the game.
    while True:
        # Watch for keyboard and mouse events.
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

 # Make the most recently drawn screen visible.
run_game()
pygame.display.flip()

I'm still learning python, and the book gave me this code, so I assume it was some kind of update from Python or pygame or both. Also, even when I remove pygame.display.flip(), it still gives the same error

qouify
  • 3,698
  • 2
  • 15
  • 26
  • Look at the order you are doing things: you are trying to `pygame.display.flip()` before you have created a pygame display window. – Dúthomhas Feb 16 '22 at 02:44
  • I changed the code a little bit and I'm still getting the same issue, I updated the question with the new code. – akgamer182 Feb 16 '22 at 03:00
  • 2
    What is your error in the first place? It runs without problem in my pc. – hata Feb 16 '22 at 03:45

0 Answers0