    def play(self, scenes, stop_on_resize=False, unhandled_input=None,
             start_scene=None, repeat=True, allow_int=False):
        """
        Play a set of scenes.

        This is effectively a helper function to wrap :py:meth:`.set_scenes` and
        :py:meth:`.draw_next_frame` to simplify animation for most applications.

        :param scenes: a list of :py:obj:`.Scene` objects to play.
        :param stop_on_resize: Whether to stop when the screen is resized.
            Default is to carry on regardless - which will typically result
            in an error. This is largely done for back-compatibility.
        :param unhandled_input: Function to call for any input not handled
            by the Scenes/Effects being played.  Defaults to a function that
            closes the application on "Q" or "X" being pressed.
        :param start_scene: The old Scene to start from.  This must have name
            that matches the name of one of the Scenes passed in.
        :param repeat: Whether to repeat the Scenes once it has reached the end.
            Defaults to True.
        :param allow_int: Allow input to interrupt frame rate delay.

        :raises ResizeScreenError: if the screen is resized (and allowed by
            stop_on_resize).

        The unhandled input function just takes one parameter - the input
        event that was not handled.
        """
        # Initialise the Screen for animation.
        self.set_scenes(
            scenes, unhandled_input=unhandled_input, start_scene=start_scene)

        # Mainline loop for animations
        try:
            while True:
                a = time.time()
                self.draw_next_frame(repeat=repeat)
                if self.has_resized():
                    if stop_on_resize:
                        self._scenes[self._scene_index].exit()
                        raise ResizeScreenError("Screen resized",
                                                self._scenes[self._scene_index])
                b = time.time()
                if b - a < 0.05:
                    # Just in case time has jumped (e.g. time change), ensure we only delay for 0.05s
                    pause = min(0.05, a + 0.05 - b)
                    if allow_int:
                        self.wait_for_input(pause)
                    else:
                        time.sleep(pause)
        except StopApplication:
            # Time to stop  - just exit the function.
            return
Play a set of scenes.

This is effectively a helper function to wrap :py:meth:`.set_scenes` and
:py:meth:`.draw_next_frame` to simplify animation for most applications.

:param scenes: a list of :py:obj:`.Scene` objects to play.
:param stop_on_resize: Whether to stop when the screen is resized.
Default is to carry on regardless - which will typically result
in an error. This is largely done for back-compatibility.
:param unhandled_input: Function to call for any input not handled
by the Scenes/Effects being played.  Defaults to a function that
closes the application on "Q" or "X" being pressed.
:param start_scene: The old Scene to start from.  This must have name
that matches the name of one of the Scenes passed in.
:param repeat: Whether to repeat the Scenes once it has reached the end.
Defaults to True.
:param allow_int: Allow input to interrupt frame rate delay.

:raises ResizeScreenError: if the screen is resized (and allowed by
stop_on_resize).

The unhandled input function just takes one parameter - the input
event that was not handled.
asciimatics/screen.py