K
K
Kihl2021-06-13 15:06:26
pygame
Kihl, 2021-06-13 15:06:26

pygame window color not changing?

Wanted to change the color of the pygame window, but the screen is always black. Please help me. Here is the code. (Where (pixel.screen_width, pixel.screen_height) they are both 900)

import sys
import pygame
from settings import Settings
def game():
 
# Экран.
    pygame.init()
pixel = Settings()
screen = pygame.display.set_mode((pixel.screen_width, pixel.screen_height))
pygame.display.set_caption("Play")
 
# Запуск цикла игры.
run = True
while run:
 
#Клавиатура и мышь.
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
 
# Отображение последнего прорисованного экрана.
screen.fill(pygame.Color(255, 0, 0))
pygame.display.flip()
 
game()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question