pyTooling.TerminalUI
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 pyTooling.TerminalUI 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 pyTooling.TerminalUI import LineTerminal, ILineTerminal
class SubModule(ILineTerminal):
def __init__(self, configFile: Path, terminal):
super().__init__(terminal)
if not configFile.exists():
self.WriteError(f"Config file '{configFile}' not found.")
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
Metadata
Release files for pyTooling.TerminalUI 1.5.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyTooling.TerminalUI-1.5.9.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyTooling.TerminalUI-1.5.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.7 kB
Release files / pyTooling.TerminalUI-1.5.9.tar.gz
| Download URL | pyTooling.TerminalUI-1.5.9.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7dfe4754f8edb5b08fe1bd6111a6665a0dfe7f42288d40575bf7e490cb86b10a
|
|
BLAKE2b-256 checksum How to use checksums |
a2df5154688da8f8a4819031d3477657462baa7c3279b15a4845526ce276e435
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / pyTooling.TerminalUI-1.5.9-py3-none-any.whl
| Download URL | pyTooling.TerminalUI-1.5.9-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2217751fc2fffdde0c87263990328e820e302503e3c499f21b2f934857e6dc60
|
|
BLAKE2b-256 checksum How to use checksums |
364c721c66466e8b42da556bc0084eaa0c1385bb617aaa7b9584d79c682930de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|