import pygame pygame.init() print_message = pygame.USEREVENT + 0 pygame.time.set_timer(print_message, 3000) displaySurface = pygame.display.set_mode((300, 300)) mySurface = pygame.Surface ((50, 50)) mySurface.fill((0,255,0)) mySurface2 = pygame.Surface((100, 50)) mySurface2.fill((0,255,0)) pos = [175, 125] screen = pygame.display.set_mode((400, 300)) background = pygame.Surface((400,300)) while True: for event in pygame.event.get(): if event.type == print_message: print("Hello World") screen.blit(background, (0, 0)) screen.blit(mySurface, pos) pygame.display.update() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit()