Skip to main content

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

Project description

Sourcecode on GitHub Sourcecode License GitHub tag (latest SemVer incl. pre-release) GitHub release (latest SemVer incl. including pre-releases) GitHub release date Dependents (via
GitHub Workflow - Build and Test Status Codacy - Quality Codacy - Coverage Codecov - Branch Coverage SourceRank
PyPI PyPI - Python Version PyPI - Status status for latest release
Read the Docs Documentation License Documentation - Read Now!


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


  • Colored command line outputs based on colorama
  • Message classification in fatal, error, warning, normal, quiet, ...
  • Get information like terminal dimensions from underlying terminal window

Simple Terminal Application

This is a minimal terminal application example which inherits from LineTerminal.

from pyTerminalUI import LineTerminal

class Application(LineTerminal):
  def __init__(self):
    super().__init__(verbose=True, debug=True, quiet=False)

  def run(self):
    self.WriteNormal("This is a simple application.")
    self.WriteWarning("This is a warning message.")
    self.WriteError("This is an error message.")

# entry point
if __name__ == "__main__":
  app = Application()

Complex Terminal Application

This example hands over the terminal instance to a submodule, which implements ILineTerminal, so the submodule can also use the terminal's writing methods.

from pathlib      import Path
from pyTerminalUI import LineTerminal, ILineTerminal

class SubModule(ILineTerminal):
  def __init__(self, configFile, terminal):

    if not configFile.exists():
      self.WriteError("Config file '{0!s}' not found.".format(configFile))

class Application(LineTerminal):
  def __init__(self):
    super().__init__(verbose=True, debug=True, quiet=False)

    mod = SubModule(Path("config.yml"), self)

  def run(self):

# entry point
if __name__ == "__main__":
  app = Application()



This Python package (source code) licensed under Apache License 2.0.
The accompanying documentation is licensed under Creative Commons - Attribution 4.0 (CC-BY 4.0).

SPDX-License-Identifier: Apache-2.0

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyTerminalUI-1.4.1.tar.gz (14.1 kB view hashes)

Uploaded source

Built Distribution

pyTerminalUI-1.4.1-py3-none-any.whl (12.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page