pygame,屏幕未更新或未填充正确的颜色

pygame, screen not updating or filling with correct color

正在尝试开始一个新的 pygame 项目。非常基本的东西。只是想给屏幕上色。目前屏幕打开,变白。控制台中没有错误。 这是我的代码:

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()

如果它只是显示绿屏,我会很高兴。知道我的问题是什么吗?

升级到最新版本 pygame 解决了这个问题。

pip3 install pygame --upgrade

感谢@rabbid76 的解决方案