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.7+ 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

# Import the necessary packages
from cursesmenu import *
from cursesmenu.items import *

# Create the menu
menu = CursesMenu("Title", "Subtitle")

# Create some items

# MenuItem is the base class for all items, it doesn't do anything when selected
menu_item = MenuItem("Menu Item")

# A FunctionItem runs a Python function when selected
function_item = FunctionItem("Call a Python function", input, ["Enter an input"])

# A CommandItem runs a console command
command_item = CommandItem("Run a console command", "touch hello.txt")

# A SelectionMenu constructs a menu from a list of strings
selection_menu = SelectionMenu(["item1", "item2", "item3"])

# A SubmenuItem lets you add a menu (the selection_menu above, for example)
# as a submenu of another menu
submenu_item = SubmenuItem("Submenu item", selection_menu, menu)

# Once we're done creating them, we just add the items to the menu
menu.items.append(menu_item)
menu.items.append(function_item)
menu.items.append(command_item)
menu.items.append(submenu_item)

# Finally, we call show to show the menu and allow the user to interact
menu.show()

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.6.6.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

curses_menu-0.6.6-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

Details for the file curses-menu-0.6.6.tar.gz.

File metadata

  • Download URL: curses-menu-0.6.6.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.4 Darwin/21.6.0

File hashes

Hashes for curses-menu-0.6.6.tar.gz
Algorithm Hash digest
SHA256 de87c0463e3aa03d5764abd77e99b8c6c0f18b4a7389f1e16147a673bd02980e
MD5 5ae94c534eecd7b902042e69e3b604c5
BLAKE2b-256 b7c11fa8cf4a1279b26e4564dae04dcaa7a5ee30450689a60b30f51ea5ef8ce0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: curses_menu-0.6.6-py3-none-any.whl
  • Upload date:
  • Size: 38.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.4 Darwin/21.6.0

File hashes

Hashes for curses_menu-0.6.6-py3-none-any.whl
Algorithm Hash digest
SHA256 255dd539e9a658d5ea6221b2deac85e15be7c681823879b439fa29dcbaa04cb7
MD5 a30ffa9806299a09a5fe7386a1d33687
BLAKE2b-256 e5cd0a280baad82b3031d0dab6b3342ceb8ce7d3832226232ae82363f010ed7a

See more details on using hashes here.

Supported by

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