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,menuSize,autoAddQuit,onlyReturnNumber, allowedCharacters, acceptedQuitCharacters)

With these parameters :

menuName               - Required : name of the menu (Str)
menuItems              - Required : menu items ["item 1","item 2"] (List)
inputQuestion          - Optional : Question input (Str)
menuSize               - Optional : Size of the menu (Int)
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:",76,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:

it looks correct in the python console

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.1.1.tar.gz (3.8 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.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simple-console-menu-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 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.1.1.tar.gz
Algorithm Hash digest
SHA256 2c44d56699e5179dc91ce8740d8eb3a8e68cad9e957fd290edeee3fa5fff2da3
MD5 89af1bd6b521fa6c1e3295dfbc671aae
BLAKE2b-256 3f788aa201de6a138ac4e6b878197e97d43cb7313cfb9de523af8fae56ab87d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_console_menu-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 629226a16985d5c3ae071c0384ee461c22e7e07eff8b45fe083a1341b4971b6c
MD5 88a3a4da327b9bc5bf9f4bee28c8a788
BLAKE2b-256 f1831124c306e0866c8b98a64cc7f306ba091772923a35a524dbc6e6628e3a3e

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