def esc_pause(): pausing = True while (pausing): print("pause") for event in pygame.event.get(): if (event.type == pygame.K_ESCAPE): pausing= False