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