Skip to main content

A simple console menu system using curses

Project description

Build StatusDocumentation 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 2.7, 3.3, 3.4, and 3.5, as well as pypy and pypy 3. Probably works on 2.6 as well.

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.append_item(menu_item)
menu.append_item(function_item)
menu.append_item(command_item)
menu.append_item(submenu_item)

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

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.5.0.zip (37.3 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.5.0-py3.6.egg (34.1 kB view details)

Uploaded Egg

File details

Details for the file curses-menu-0.5.0.zip.

File metadata

  • Download URL: curses-menu-0.5.0.zip
  • Upload date:
  • Size: 37.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for curses-menu-0.5.0.zip
Algorithm Hash digest
SHA256 29c45e2f16283833e2940fac0fd64e948f2ff603d3e11f510c5bd2b946cd8981
MD5 2415e53e7834dba1c97ac1e3839e45eb
BLAKE2b-256 3b7d82f1492afd33f92e64d44d51f65eff4c39382642cfced65d5748a770bb8f

See more details on using hashes here.

File details

Details for the file curses_menu-0.5.0-py3.6.egg.

File metadata

  • Download URL: curses_menu-0.5.0-py3.6.egg
  • Upload date:
  • Size: 34.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for curses_menu-0.5.0-py3.6.egg
Algorithm Hash digest
SHA256 23969fbb7851957cbc4696d3c8f9459281db759c37d65f02a834f0b409124d6c
MD5 468446d7379b70549cdfa99a19b0a02c
BLAKE2b-256 91908fdbe54c38d20f26a4dfc4c86962e4a5a8488b4395f10b5b71154bb54388

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