Terminal

A set of helpers to implement a text user interface (TUI) in a terminal.

Terminal

LineTerminal

Introduction

This package offers a pyTooling.TerminalUI.LineTerminal implementation, derived from a basic pyTooling.TerminalUI.Terminal class. It eases the creation of simple terminal/console applications. It includes colored outputs based on colorama.

List of base-classes

  • pyTooling.TerminalUI.Terminal

  • pyTooling.TerminalUI.LineTerminal

Example

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 Severity-level of a Line object.