Skip to main content

Yet another simple console menu

Project description

python-simple-menu

A lightweight console menu package for python applications. No frills, no fuss.

Installing

To install to your project, run the following command:

pip install python_simple_menu

How to use

def main():
    main_menu = Menu(prompt="Main Menu")
    main_menu.items.append(FunctionItem("Item 1", __item1))
    main_menu.items.append(FunctionItem("Item 2", __item2))
    
    sub_menu1 = Menu(prompt="Sub-Menu 1", parent=main_menu)
    sub_menu1.items.append(FunctionItem("Item 1", __item1))
    sub_menu1.items.append(FunctionItem("Item 2", __item2))
    
    main_menu.items.append(MenuItem(sub_menu1))    
    main_menu.run()

def __item1():
    print('lorem ipsum...')

def __item2():
    print('dolor sit amet...')

The menu will run until the user chooses Quit ("Q"), which will exit the application. If the menu has a parent menu, an additional Back ("B") option will be rendered which will return the user to the parent menu.

See the python_simple_menu/examples directory for other usages.

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

python_simple_menu-1.1.6.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

python_simple_menu-1.1.6-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file python_simple_menu-1.1.6.tar.gz.

File metadata

  • Download URL: python_simple_menu-1.1.6.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.10 Windows/10

File hashes

Hashes for python_simple_menu-1.1.6.tar.gz
Algorithm Hash digest
SHA256 8cb8a80a6c5a488a0fbdfe8592a368a59a4b0f0cfdcfcf4548b0454c1f951fc3
MD5 9fd0cc53cedbcabc87887dde952619be
BLAKE2b-256 fe6274f517666eb43d38fbed695574c863421d8433c0ea3beff8c48d2cf78875

See more details on using hashes here.

File details

Details for the file python_simple_menu-1.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for python_simple_menu-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c6eadb66f8897d964311ffe7cd9a89694d2ec527db7a2284e1aa8a8812e59f
MD5 1a1afd4e6c6338943eda30480038f0db
BLAKE2b-256 c9262c785eb93c443c2c6fc89efb788670168dd4e45f926eccdf886e455d07a4

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