🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

py-menu-tui

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

py-menu-tui

This project implements a keyboard-controlled text user interface (TUI) for the terminal that allows users to navigate menus and nested subsections using simple key inputs (w, s, Enter, Esc). It provides a lightweight framework for building interactive CLI applications with features like menu navigation, subsections, progress bars, and confirmation prompts.

pipPyPI
Version
0.2.11
Maintainers
1

py_menu_tui

py_menu_tui is a lightweight terminal user interface (TUI) navigation framework for Python.
It allows developers to quickly build interactive command-line menus with keyboard navigation and nested subsections.

The interface is controlled using simple keys and is designed for Windows terminals using msvcrt.

Features

  • Keyboard navigation (w / s)
  • Nested menu sections
  • Simple function binding to menu entries
  • Scrollable menus
  • Progress bar utility
  • Confirmation prompts
  • No external dependencies

Installation

Currently the package can be installed with:

pip install py_menu_tui

Controls

KeyAction
wMove up
sMove down
EnterSelect option
EscGo back
Ctrl+CExit program

Example

from py_menu_tui import UserInterface

def hello():
    print("Hello World")

ui = UserInterface()

ui.setup(
    ["Say Hello"],
    [hello]
)

ui.begin()

Creating Subsections

# Create a subsection
ui.add_sub_section(
    ["Option 1", "Option 2"],
    [func1, func2],
    section="Settings"
)

# Create a nested subsection inside "Settings"
ui.add_sub_section(
    ["Option 1", "Option 2"],
    [func1, func2],
    section="Audio",
    uppersection="Settings"
)

Utilities

#Progressbar
from py_menu_tui import progressbar
progressbar(50)

#Clear Terminal
from py_menu_tui import clear
clear()

#Confirmation Prompt
from py_menu_tui import confirm

if confirm("Continue?"):
    print("Confirmed")

#Wait for user input
ui.hold()

# Wait 5 seconds
ui.hold(time=5)

# Custom message and wait for input
ui.hold(msg="Press enter to continue")

Requirements

  • Python 3+
  • Windows terminal (uses msvcrt)
  • No external dependencies

License

This project is licensed under the MIT License.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts