Skip to main content

Basic text menu for console

Project description

Python text menu

Python module for interacting with the user through console, to install module from pip execute:

pip install python_text_menu

Simple use

from python_text_menu import print_menu

options = ['Option 1', 'Option 2', 'Option 3']
choice = print_menu(options)

Output:

Menu:
[1] Option 1
[2] Option 2
[3] Option 3
[4] Exit
Select an option: 

Then you can create your own flow based on 'choice':

if choice == '1':
    # Do something
elif choice == '2':
    # Do something else
...

Customize

You can customize it by giving it a title, a separator and/or an input text:

options = ['Option 1', 'Option 2', 'Option 3']
choice = print_menu(options, title='New title', sep=''*20, input_text='Choose something...')

Output:

New title:
====================
[1] Option 1
[2] Option 2
[3] Option 3
[4] Exit
Choose something...

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_text_menu-0.0.4.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

python_text_menu-0.0.4-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

Supported by

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