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 simple_menu

How to Use

def main():
	# Create a main menu
	m = Menu(prompt="Main Menu")
	m.items.append(FunctionItem(label="Item 1", function=lambda: print("Item 1")))

	# Create a sub-menu
	m2 = Menu(parent=m, prompt="Sub Menu 1")
	m2.items.append(FunctionItem(label="Item 2", function=lambda: print("Item 2")))

	# Add the sub-menu to the main menu
	m.items.append(MenuItem(label="Sub Menu 1", menu=m2))

	# Run the menu
	m.run()


if __name__ == "__main__":
	main()

The menu will run until the user chooses the Quit item, which will exit the application. When entering a sub-menu, an additional "go back" option is added which will return the user to the parent menu. The various prompts can be customized in the Menu() constructor.

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.5.tar.gz (3.4 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.5-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for python_simple_menu-1.1.5.tar.gz
Algorithm Hash digest
SHA256 aaf7fd272f2ad2061bc7ea42b4265d5d10dad0d9fc5a29b4cf73798be6510b52
MD5 c060ac7c47d32ccd234ba2f447385488
BLAKE2b-256 c1c0d8eb509e9c24f470c93fd37135d47a52b295e5f3fe84830a73759e091ee9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_simple_menu-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 627a9b4fd77d6fc18ad21fb6b31fd1c98fb4107978fc78accfb552f6cc3beb9f
MD5 a11cae970c74e139135c11b847cf78bb
BLAKE2b-256 452ba2f00d8cce255655a5f10d35d782cfb6243341894cb5f9aaac186016861e

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