import pygame def anykey(): for event in pygame.event.get(): if event.type in (pygame.MOUSEBUTTONDOWN, pygame.KEYDOWN, pygame.QUIT): return True return False