1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
.. _TERM:
Terminal
########
A set of helpers to implement a text user interface (TUI) in a terminal.
.. _TERM/Terminal:
Terminal
********
.. _TERM/LineTerminal:
LineTerminal
************
Introduction
************
This package offers a :class:`pyTooling.TerminalUI.LineTerminal` implementation, derived from a basic
:class:`pyTooling.TerminalUI.Terminal` class. It eases the creation of simple terminal/console applications. It
includes colored outputs based on `colorama`.
List of base-classes
********************
* :class:`pyTooling.TerminalUI.Terminal`
* :class:`pyTooling.TerminalUI.LineTerminal`
Example
*******
.. code-block:: Python
from pyTooling.TerminalUI import LineTerminal
class Application(LineTerminal):
def __init__(self) -> None:
super().__init__(verbose=True, debug=True, quiet=False)
def run(self):
self.WriteQuiet("This is a quiet message.")
self.WriteNormal("This is a normal message.")
self.WriteInfo("This is an info message.")
self.WriteDebug("This is a debug message.")
self.WriteWarning("This is a warning message.")
self.WriteError("This is an error message.")
self.WriteFatal("This is a fatal message.")
# entry point
if __name__ == "__main__":
Application.CheckPythonVersion((3,6,0))
app = Application()
app.run()
app.Exit()
Line
####
``Line`` represents a single line in a line-based terminal application. If a
line is visible, depends on the :class:`~pyTooling.TerminalUI.Severity`-level of a
``Line`` object.
|