pythonpygame

pygame, screen not updating or filling with correct color


Trying to start a new pygame project. Very basic stuff. Just trying to color the screen. Currently the screen opens, and goes white. There are no errors in the console. here is my code:

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:
  
    screen.fill((0,255,0))
    for event in pygame.event.get():

      if event.type == pygame.QUIT:
        sys.exit()
    pygame.display.flip() # same result with .update

run_game()

id be happy if it would simply show a green screen. Any ideas what my issue could be?


Solution

  • Upgrading to the most recent version of pygame fixed this.

    pip3 install pygame --upgrade
    

    thanks to @rabbid76 for the solution