# Скелет проекта import pygame # import random # import time WIDTH = 360 HEIGHT = 480 FPS = 30 # Define useful colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) # Инициализация пайгейма и создание окна pygame.init() pygame.mixer.init() screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption('Project 404') clock = pygame.time.Clock() # GAME LOOP running = True while running: clock.tick(FPS) for event in pygame.event.get(): # check for closing the window if event.type == pygame.QUIT: running = False # keep loop running at the right speed # Process inputs (events) # Update # Draw / Render screen.fill(WHITE) # After drawing everything flip display. pygame.display.flip() # pygame.quit() What is wrong in the code? On Windows, the same code consumes only 12% of the CPU.
clock.tick(FPS)withtime.sleep(1), it’s still eating percents, I tried it first - andreymal