import pygame pygame.init() print_message = pygame.USEREVENT + 0 pygame.time.set_timer(print_message, 3000) pygame.time.set_timer(print_message,0) while True: for event in pygame.event.get(): if event.type == print_message: print("hello world")