0

I tried this code to be able to pause my game but if I don't press the button before 2-3 seconds the PyGame window will crash. Any idea why that is?

screen = pygame.display.set_mode([screen_width,screen_height])

def game_pause():
    pause = True
    while pause == True:
        keyboard.wait('RETURN')
        pause = False
Zoler1337
  • 108
  • 5
  • Each UI application have event queue, that collects events like mouse move or keyboard input. If OS finds that application doesn't read from queue for some time, OS thinks that application is frozen (not responding) and may kill it – JL0PD Jan 06 '22 at 13:05
  • You shouldn't use `keyboard.wait` when using [pygame](https://www.pygame.org/news). – Rabbid76 Jan 06 '22 at 13:17

0 Answers0