[Python] pygame, screen not updating or filling with correct color

Discussão em 'Python' iniciado por Stack, Março 29, 2025.

  1. Stack

    Stack Membro Participativo

    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?

    Continue reading...

Compartilhe esta Página