Skip to main content

A simple console menu system using curses

Project description

Build StatusDocumentation StatusCoverage Status

curses-menu

A simple Python menu-based GUI system on the terminal using curses. Perfect for those times when you need a GUI, but don’t want the overhead or learning curve of a full-fledged GUI framework. However, it’s also flexible enough to do cool stuff like on-the-fly changing of menus and is extensible to a large variety of uses.

http://curses-menu.readthedocs.org/en/latest/

./images/curses-menu_screenshot1.png

Installation

Tested on Python 3.8+ pypy and pypy3.

The curses library comes bundled with python on Linux and MacOS. Windows users can visit http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses and get a third-party build for your platform and Python version.

Then just run

pip install curses-menu

Usage

It’s designed to be pretty simple to use. Here’s an example

menu = CursesMenu("Root Menu", "Root Menu Subtitle")
item1 = MenuItem("Basic item that does nothing", menu)
function_item = FunctionItem("FunctionItem, get input", input, ["Enter an input: "])
print(__file__)
command_item = CommandItem(
    "CommandItem that opens another menu",
    f"python {__file__}",
)

submenu = CursesMenu.make_selection_menu([f"item{x}" for x in range(1, 20)])
submenu_item = SubmenuItem("Long Selection SubMenu", submenu=submenu, menu=menu)

submenu_2 = CursesMenu("Submenu Title", "Submenu subtitle")
function_item_2 = FunctionItem("Fun item", input, ["Enter an input"])
item2 = MenuItem("Another Item")
submenu_2.items.append(function_item_2)
submenu_2.items.append(item2)
submenu_item_2 = SubmenuItem("Short Submenu", submenu=submenu_2, menu=menu)

menu.items.append(item1)
menu.items.append(function_item)
menu.items.append(command_item)
menu.items.append(submenu_item)
menu.items.append(submenu_item_2)

menu.start()
_ = menu.join()

Testing Information

Currently the platforms I’m manually testing on are MacOS in iTerm2 on zsh with and without TMUX and Windows 10with both powersehll and cmd.exe in and out of Windows Terminal. If a bug pops up on another configuration, no promises that I’ll be able to reproduce it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

curses_menu-0.9.0.tar.gz (76.3 kB view details)

Uploaded Source

Built Distribution

curses_menu-0.9.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file curses_menu-0.9.0.tar.gz.

File metadata

  • Download URL: curses_menu-0.9.0.tar.gz
  • Upload date:
  • Size: 76.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for curses_menu-0.9.0.tar.gz
Algorithm Hash digest
SHA256 2d4dc7f3ed27377b3f455dd56cbe87d1bc4e9c09af558dc89eb01e36fe95eb97
MD5 42bf2b7259a3764a00b2c28cd560ef98
BLAKE2b-256 f5d0b1e36f29937b6c5dd75563deebb7224dd71ea0b471ee9c44df601a7be7f9

See more details on using hashes here.

File details

Details for the file curses_menu-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: curses_menu-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for curses_menu-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb24df4948c32216663439470630b9732a16d09bbbb533c5b0aa8205aeb292fd
MD5 411ac5fdafdd0289d2e7e3d741a7f8b8
BLAKE2b-256 6f7b8c1aeda890e6af299bfb56ecab40dde188e95b67d1852a6e63612d85f74a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page