pyTerminalUI
A set of helpers to implement a text user interface (TUI) in a terminal.
Features
- 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__":
Application.versionCheck((3,6,0))
app = Application()
app.run()
app.exit()
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):
super().__init__(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):
pass
# entry point
if __name__ == "__main__":
app = Application()
app.run()
Contributors
- Patrick Lehmann (Maintainer)
- and more...
License
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
Release files for pyTerminalUI 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyTerminalUI-1.4.1.tar.gz | 14.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyTerminalUI-1.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.5 kB
Release files / pyTerminalUI-1.4.1.tar.gz
| Download URL | pyTerminalUI-1.4.1.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53706cd805e55cddce4624167ff2937e791edcf3190ee172d68fed6a490a01f8
|
|
BLAKE2b-256 checksum How to use checksums |
02d53b284930480157504ec33f223363f5b8af60203791f5a5795ad8c70e5381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|
Release files / pyTerminalUI-1.4.1-py3-none-any.whl
| Download URL | pyTerminalUI-1.4.1-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1838bf51b4055d918993432f9dc124b9e1b4aac770fd3c1f12b4f405f8c72dd
|
|
BLAKE2b-256 checksum How to use checksums |
bb2c40a9a1eae81e454bb53df8f57056bd48df8202826fab018dcbb4c79424c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|