def handle_event(self, event): if event.type == pygame.KEYDOWN: if event.key in [pygame.K_ESCAPE]: self.parent.trigger_exit_to_main()