import abc from typing import Optional class Display(metaclass=abc.ABCMeta): """ Displays are an abstraction over printing things to the screen. Use a specific implementation based on the kind of display you want to use. """ @abc.abstractmethod def line(self, line: str = ""): "Print a single line to the display." @abc.abstractmethod def input(self) -> str: "Get player input." @abc.abstractmethod def wait_for_ack(self, prompt: Optional[str] = None): """ Wait for the user to press a key. The behavior is up to the implementor. This could be something like "press any key to continue", "press enter to continue", or "click OK to continue". This method should block until input is acknowleged by the user. """ def finish(self): "Final cleanup code for this display."