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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for python_text_menu-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee998767c810f3b6d8b98d3db0f44ab84e26bbd9574dd30804c980b2deb4e713 |
|
MD5 | 465f550f1334b3501ece4c4625e18f05 |
|
BLAKE2b-256 | cfbd1beafa289592742d6384f03275d7bc0b278b003c25db904d24ce20c6adc2 |