Skip to main content

A simple console menu system

Project description

Build StatusDocumentation Status

console-menu

A simple Python menu-based UI system for terminal applications. Perfect for those times when you need a menu-driven program, but don’t want the overhead or learning curve of a full-fledged GUI framework.

Derived from the curses-menu project, but with curses dependency removed.

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

./images/console-menu_screenshot1.png ./images/console-menu_screenshot2.png

Installation

Tested on Python 2.7, 3.4, 3.5, and 3.6, as well as pypy and pypy 3.

Installation can be performed by running pip

pip install console-menu

Usage

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

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

# Create the menu
menu = ConsoleMenu("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

console-menu-0.5.1.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

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

console_menu-0.5.1-py2.py3-none-any.whl (27.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file console-menu-0.5.1.tar.gz.

File metadata

  • Download URL: console-menu-0.5.1.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/2.7.10

File hashes

Hashes for console-menu-0.5.1.tar.gz
Algorithm Hash digest
SHA256 a3e09d6dfb263a20e2cc44601a723ca4c3c3e31a869b2a289e86833956b7b62e
MD5 7d9cfeac82f245920a596c1e200d18bd
BLAKE2b-256 adc946ac32580870de52aa0a13d4f557b7d52de27c4c960e96c687509bb12564

See more details on using hashes here.

File details

Details for the file console_menu-0.5.1-py2.py3-none-any.whl.

File metadata

  • Download URL: console_menu-0.5.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/2.7.10

File hashes

Hashes for console_menu-0.5.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b6ce4173341fac72fe693a271369385d354633e343539c72a54b94d540597e13
MD5 831afb6e24da3d38a719e13ba827c0b5
BLAKE2b-256 f32d8e98aa57fe8027e464bdf315478f0dc6fce86e6c98ecb5013371c6f2fb29

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