Skip to main content

A simple console menu

Project description

Simple console menu

This is a simple console menu

SimpleConsoleMenu


The first menu is the SimpleConsoleMenu.
You can use it by first importing the right file:

from simple_console_menu import Menu

And if you want to use it you can do this:

menu = Menu.SimpleConsoleMenu(menuName,menuItems,inputQuestion,autoAddQuit,onlyReturnNumber, allowedCharacters = '', acceptedQuitCharacters = '')

With these parameters :

menuName               - Required : name of the menu (Str)
menuItems              - Required : menu items, separated with ';' (Str)
inputQuestion          - Required : Question input (Str)
autoAddQuit            - Optional : automatically add a quit option (Bool)
onlyReturnNumber       - Optional : only numbers are allowed to return (Bool)
allowedCharacters      - Optional  : specifier which character(s) are allowed if onlyReturnNumber is False, separated with ';' (str)
acceptedQuitCharacters - Optional  : specifier which character is allowed if onlyReturnNumber is False for quit (str)

full example:

from simple_console_menu import Menu

menuNumber = Menu.SimpleConsoleMenu('menu','item1;item2;item3;item4;item5',"Number:",True)

if menuNumber == 1:
    print('item1')
elif menuNumber == 2:
    print('item2')
elif menuNumber == 3:
    print('item3')
elif menuNumber == 4:
    print('item4')
elif menuNumber == 5:
    print('item5')

And this wil display

----------------------------------- menu -----------------------------------
1. item1
2. item2
3. item3
4. item4
5. item5
6. Quit
----------------------------------------------------------------------------
Number:1
item1

There is also SimpleConsoleMenuBlock which works the same as SimpleConsoleMenu but looks like this:

╭────────────────────────────────── menu ──────────────────────────────────╮
│1. item1                                                                  │
│2. item2                                                                  │
│3. item3                                                                  │
│4. item4                                                                  │
│5. item5                                                                  │
│6. Quit                                                                   │
╰──────────────────────────────────────────────────────────────────────────╯
Number:

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

simple-console-menu-0.0.8.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

simple_console_menu-0.0.8-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file simple-console-menu-0.0.8.tar.gz.

File metadata

  • Download URL: simple-console-menu-0.0.8.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for simple-console-menu-0.0.8.tar.gz
Algorithm Hash digest
SHA256 025fe7b648eaf6b4450a42aedfa945488c8a2a6bd47470a7e90edd9de997b96a
MD5 d2e11177e779d868e5613d586b8610ba
BLAKE2b-256 189c652fbf957d1a3f2f2621f42b79d2d9058c14af8e3252042bcea04b5f7146

See more details on using hashes here.

File details

Details for the file simple_console_menu-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_console_menu-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 374b57af116b92b4c233fd6c4d0902807041f5f8e8bcb563a82bfe33e707d1b2
MD5 2d37788cb65eb4bd8b6ea1450c577f2c
BLAKE2b-256 6bd675f55cae3dc42af03d44e68aa30a477ef3c450a0538a6a2b076c8d0cad87

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