Skip to main content

Simple wrapper that helps you write a menu driven program easily.

Project description

mendi

Simple wrapper that helps you write a menu-driven program easily.

A menu-driven program is one, in which the user is provided a list of choices. A particular action is done when the user chooses a valid option. There is also an exit option, to break out of the loop. Error message is shown on selecting a wrong choice.

Installation

pip install mendi

Usage

This is a simple snippet showing you the use of mendi

from mendi import drive_menu

a = int(input('Enter a number: '))

def add():
    print(a+1)

def substract():
    print(a-1)

options = {}

options['1'] = {'desc': 'Add', 'func': add}
options['2'] = {'desc': 'Substract', 'func': substract}

drive_menu('Calculate', options)

Here is a sample output:

output

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

mendi-0.0.2.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

mendi-0.0.2-py3-none-any.whl (2.7 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