Lightweight terminal menu library with TTY fallback and safe output
Project description
pickpy: Lightweight Terminal Menus for Python
📝 Usage example
Here's a quick example to spark your imagination:
from pickpy.menu import TerminalMenu
options = ["Start Game", "Options", "Exit"]
menu = TerminalMenu()
choice = menu.select_option(
options,
header="Pickpy Demo: Use arrow keys to navigate and press Enter"
)
match choice:
case "Start Game":
print("Starting game... (demo)")
case "Options":
print("Opening options...")
case "Exit":
print("Exiting...")
Are you tired of clunky, hard-to-use terminal menus? Want to build sleek, interactive command-line interfaces with minimal effort? Look no further — pickpy is here to revolutionize how you create terminal menus in Python!
🎨 Custom colors
You can customize colors easily using ANSI strings or the built-in BColors enum:
from pickpy.menu import TerminalMenu
from pickpy.terminal import BColors
menu = TerminalMenu()
# Interactive menu with custom colors
choice = menu.select_option(
["Start", "Options", "Exit"],
header="Custom Colors Demo",
header_color=BColors.OKBLUE,
selected_color=BColors.WARNING,
unselected_color=BColors.OKGREEN,
)
# Fallback (non-TTY) also supports custom colors via get_choice
choice = menu.get_choice(
["Red", "Green", "Blue"],
header="Pick a color:",
header_color=BColors.WARNING,
option_color=BColors.OKGREEN,
)
# Customize input prompt color
match choice:
case "Red":
menu.terminal.safe_print("You picked Red!", color=BColors.FAIL)
case "Green":
menu.terminal.safe_print("You picked Green!", color=BColors.OKGREEN)
case "Blue":
menu.terminal.safe_print("You picked Blue!", color=BColors.OKBLUE)
🚀 Why choose pickpy?
- Lightweight & Easy to Use: Designed for simplicity, perfect for quick prototyping or production use.
- Flexible & Customizable: Supports color, navigation via arrow keys, and safe terminal handling – all out of the box.
- Cross-Platform Compatibility: Works smoothly on Windows, macOS, and Linux.
- Extensible & Modular: Built with best practices to allow easy future enhancements.
🎯 What can you do with pickpy?
- Build interactive menus with arrow key navigation
- Present choices with color themes and style
- Support non-interactive environments gracefully
- Easily extend or embed into your scripts or tools
📦 Installation
Getting started is a snap:
pip install pickpy
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 pickpy-0.1.1.tar.gz.
File metadata
- Download URL: pickpy-0.1.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e61d57c0a0e56a8ff4e640b724dcdab0710ae2e75c90b7f43fc9bf1d03a08227
|
|
| MD5 |
de8f4499e018c77b75368333f9b21d15
|
|
| BLAKE2b-256 |
19e9e5862fc08ef38216a469f3f21617903104a3c597f0efd1816906123d85a7
|
File details
Details for the file pickpy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pickpy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af928d5385ef67dbd80ca937353e89030e1e210735f9eea0917e020c69d1630e
|
|
| MD5 |
1ca412de0adba196ef09c377e5058a86
|
|
| BLAKE2b-256 |
8e5fdecbba4663f218341adc2434f02b6ea77806c017fe8121847e2e4469c324
|