Питон потребляет максимальные ресурсы ЦП при запуске дефолтного окна Pygame

import pygame
import configs

menu = True

def Programm():
    global menu
    done = False
    
    BG = (20,20,20)

    W = configs.W
    H = configs.H
    screen = pygame.display.set_mode((W, H), pygame.RESIZABLE)
    
    pygame.init()
    pygame.display.set_caption(f"{configs.PROJECT_NAME}")
    #pygame.display.set_icon(ICON)
    clock = pygame.time.Clock()

    mouseX = 0; mouseY = 0

    while not done:
        if menu == False:
            for event in pygame.event.get():

                pressed_mouse_button = pygame.mouse.get_pressed()

                if event.type == pygame.QUIT:
                    done = True
                elif event.type == pygame.VIDEORESIZE:
                    configs.W = event.w
                    configs.H = event.h
                    Programm();sys.exit()

                elif event.type == pygame.MOUSEBUTTONDOWN:
                    x = event.pos[0]
                    y = event.pos[1]

                    button = event.button

                    if button == 1:
                        pass
                        
                    elif button == 3:
                        pass

                elif event.type == pygame.MOUSEWHEEL:
                    pass

                elif event.type == pygame.MOUSEMOTION:
                    x = event.pos[0]
                    y = event.pos[1]
                    mouseX = x; mouseY = y
                                
            screen.fill(BG)

            '''
                D R A W I N G
            '''

            pygame.display.update()
            clock.tick(configs.FPS)

        else:

            '''
                   ГЛАВНОЕ МЕНЮ
            '''

            for event in pygame.event.get():
                pressed_mouse_button = pygame.mouse.get_pressed()
                if pressed_mouse_button[0]:
                    x = event.pos[0]
                    y = event.pos[1]

                if event.type == pygame.QUIT:
                    done = True
                elif event.type == pygame.VIDEORESIZE:
                    configs.W = event.w
                    configs.H = event.h
                    Programm();sys.exit()
                elif event.type == pygame.MOUSEBUTTONUP:
                    x = event.pos[0]
                    y = event.pos[1]

                    button = event.button

                    if button == 1:
                        pass

                    elif button == 3:
                        pass

                elif event.type == pygame.MOUSEMOTION:
                    x = event.pos[0]
                    y = event.pos[1]

                    mouseX = x; mouseY = y

                screen.fill(BG)

                pygame.display.update()
                clock.tick(configs.FPS_MENU)
Programm()

Ответы (0 шт):