def play(self, scenes, stop_on_resize=False, unhandled_input=None,
             start_scene=None):
        # Set up default unhandled input handler if needed.
        if unhandled_input is None:
            unhandled_input = self._unhandled_event_default

        # Find the starting scene.  Default to first if no match.
        index = 0
        if start_scene is not None:
            for i, scene in enumerate(scenes):
                if scene.name == start_scene.name:
                    index = i
                    break
            else:
                # No match - ignore the old Scene.
                start_scene = None

        # Mainline loop for animations
        self.clear()
        while True:
            scene = scenes[index]
            try:
                frame = 0
                if scene.clear:
                    self.clear()
                # Reset the Scene - only pass in the old scene once (otherwise
                # we repeat the population when we loop through all the Scenes).
                scene.reset(old_scene=start_scene, screen=self)
                if start_scene:
                    start_scene = None
                re_sized = False
                start_frame = frame
                while not re_sized:
                    frame += 1
                    for effect in scene.effects:
                        effect.update(frame)
                        if effect.delete_count is not None:
                            effect.delete_count -= 1
                            if effect.delete_count == 0:
                                scene.remove_effect(effect)
                    self.refresh()
                    event = self.get_event()
                    while event is not None:
                        event = scene.process_event(event)
                        if event is not None:
                            unhandled_input(event)
                        event = self.get_event()
                    re_sized = self.has_resized()
                    if (scene.duration > 0 and
                            frame >= scene.duration - start_frame):
                        raise NextScene()
                    time.sleep(0.05)

                # Break out of the function if mandated by caller.
                if re_sized:
                    if stop_on_resize:
                        scene.exit()
                        raise ResizeScreenError("Screen resized", scene)
            except NextScene as e:
                if e.name is None:
                    # Just allow next iteration of loop
                    index += 1
                    if index >= len(scenes):
                        index = 0
                else:
                    # Find the required scene.
                    for i, scene in enumerate(scenes):
                        if scene.name == e.name:
                            index = i
                            break
                    else:
                        raise RuntimeError(
                            "Could not find Scene: '{}'".format(e.name))

            except StopApplication:
                # Time to stop  - just exit the function.
                return

            # Next iteration if nothing else has exited by now.
            scene.exit()
Play a set of scenes.
dataset/ETHPy150Open peterbrittain/asciimatics/asciimatics/screen.py/Screen.play