pygame.event.get() get all the messages and remove them from the queue. If
pygame.event.get () is called in multiple event loops, only one loop receives the events, but never all loops receive all events. As a result, some events appear to be missed.
Get the events once and use them in multiple loops or pass the list or events to functions and methods where they are handled:
def Close(event_list): global run for event in event_list: if event.type == pygame.QUIT: run = False
def Check_Key_Press(event_list): for event in event_list: if event.type == pygame.KEYDOWN: pass if event.key == pygame.K_LEFT: pass
run = True while run: clock.tick(60) event_list = pygame.event.get() draw_board() Check_Key_Press(event_list) Close(event_list) pygame.display.update()
CLICK HERE to find out more related problems solutions.