A professional, hotkey-driven TUI system for Python CLIs
Project description
pas-tui
A professional, hotkey-driven TUI system for Python CLIs.
This is part of the PAS Toolkit which will be open-sourced in the future, but can be used independently.
Installation
pip install pas-tui
Features
- Numerical index padding (01, 02, etc.)
- Automatic hotkey mapping (1-9, q for Quit, b for Back)
- Rich-formatted output
- Cross-platform clipboard support
Usage
Interactive Menus
The core of pas-tui is the prompt_toolkit_menu which combined with format_menu_choices provides a professional, numbered menu with hotkey support.
from pas_tui import format_menu_choices, prompt_toolkit_menu, console
from rich.panel import Panel
# 1. Define your choices
items = [
{"name": "Create Service", "action": "create"},
{"name": "Delete Service", "action": "delete"},
{"name": "Settings", "action": "settings"},
{"name": "[Quit]", "action": "quit"}
]
# 2. Format them (adds "01. ", "02. ", and maps "q." to "[Quit]")
choices = format_menu_choices(items, title_field="name", value_field="action")
# 3. Display optional header using the shared Rich console
console.print(Panel("Service Manager", style="bold blue"))
# 4. Prompt for selection
selection = prompt_toolkit_menu(choices)
if selection == "create":
print("Creating service...")
elif selection == "quit":
print("Goodbye!")
Confirmation Prompts
from pas_tui import prompt_yes_no
if prompt_yes_no("Do you want to proceed with the deletion?", default=False):
print("Deleting...")
else:
print("Aborted.")
Clipboard Support
from pas_tui import copy_to_clipboard
if copy_to_clipboard("Hello from pas-tui!"):
print("Copied to clipboard!")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pas_tui-2026.1.20.1.tar.gz.
File metadata
- Download URL: pas_tui-2026.1.20.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7012e0de59bddc07a40eb1e9f809d31fd8815926c85d7f41bdac305c9488fc59
|
|
| MD5 |
a2abf136d4e46dc2446f2357ad4f0854
|
|
| BLAKE2b-256 |
88fabfe54920e0d276fe22d0ba3b53a96e80d5ba01300bcddd7a0790f527a59d
|
File details
Details for the file pas_tui-2026.1.20.1-py3-none-any.whl.
File metadata
- Download URL: pas_tui-2026.1.20.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c06f10e10eba8ac1aeec794ab5304419772c152b1e97bedecf0d11fda3a2fc8e
|
|
| MD5 |
c0559c9152d31154e38bfefb0cfebbde
|
|
| BLAKE2b-256 |
a0245c78c451be9f5eb47dfd8b5d8fc99e5d1a5fa9c5dc421e2899e2fae32808
|