A simple yet powerful TUI framework for your Python (3.7+) applications
pip3 install pytermgui
PTG was written with some core ideas in mind, such as:
- Pythonic syntax
- Flexible systems
- High quality code
- Extensibility by design
What we provide
- Terminal mouse support
- A program with helpful CLI applications (
- A fully flegded WindowManager in the terminal
- A cross-platform getch function with key translations
- An interface to most terminal functionality
- A custom markup language with definable tags & macros inspired by Rich
- Tokenizer & optimizer methods for ANSI-sequence strings
- A robust, extensible and customizable Widget class
- Helpful example files covering most of the library
An example to get started with
# Note: This example uses the auto-conversion syntax. # For more info, check out `help(pytermgui.auto)`. import sys from pytermgui import WindowManager, Window manager = WindowManager() window = ( Window(min_width=50) + "[210 bold]My first Window!" + "" + "Try resizing the window by dragging the right border" + "Or drag the top border to move the window" + "[193 bold]Alt-Tab[/bold 157] cycles windows" + "[193 bold]CTRL_C[/bold 157] exits the program" + "" + ["New window", lambda *_: manager.add(window.copy().center())] + ["Close current", lambda _, button: manager.close(button.parent)] + ["Exit program", lambda *_: sys.exit(0)] ) manager.add(window) manager.run()
As the project is in its infancy, dedicated documentation is not yet available.
If you are interested in help about anything the module provides, you can read its docstring:
python3 -c "help(pytermgui.
However, proper documentation is coming once the API is stable.