Skip to main content

python-cli-menu is a simple cross-plateform Python module that allows you to easilly create pretty custom menus in console. Customize the title, options, every colors and initial cursor position as you wish. Use arrows keys to navigate through the menu and enter key to select an option.

Quickstart

def menu(
    title: str | Sequence[str],
    options: list[str] | tuple[str, ...],
    cursor_color: str | tuple[int, int, int],
    title_color: (
        str | tuple[int, int, int] | None |
        Sequence[str | tuple[int, int, int] | None]
    ) = None,
    options_color: (
        str | tuple[int, int, int] | None |
        Sequence[str | tuple[int, int, int] | None]
    ) = None,
    initial_cursor_position: str | int = 0,
) -> str:

Creates a pretty menu in console with arrow key navigation and returns the selected option. Clears console once an option is selected.

  • title is the main title of the menu, can be displayed on multiple lines if a list or a tuple is passed.
  • options is the list of actions or choices that can be selected.
  • cursor_color is the color of the cursor, available colors are red, green, yellow, blue, magenta, cyan, white and their lighter versions (e.g. light_red), use custom color by providing a tuple containing color RGB values.
  • title_color is the color of the title, available colors are the same as cursor_color, customize the color of each line by providing a list of colors, each color will be associated with the line of the corresponding index (default color is terminal text color).
  • options_color is the color of options, available colors are the same as cursor_color, customize every option color by providing a list of colors, each color will be associated with the option of the corresponding index (default color is terminal text color).
  • initial_cursor_position is the option or the index of the option where the initial cursor position is set (default position is first element).

Examples :

from pythonclimenu import menu

OPTIONS = ["Option 1", "Option 2", "Option 3", "Quit"]

# Creates a simple console menu with blue cursor
menu1 = menu(title="Amazing Console Menu", options=OPTIONS, cursor_color="blue")

menu2 = menu(
    title = ["Amazing Console", "Menu"], # displays title on multiple lines
    options = OPTIONS,
    cursor_color = (255, 95, 46), # sets the cursor color using RGB values
    title_color = [
        "blue", # colors "Amazing Console"
        "light_red" # colors "Menu"
    ],
    initial_cursor_position = -1 # sets cursor default position to 'Quit'
)

menu3 = menu(
    title = ["Amazing Console", "Menu"], # displays title on multiple lines
    options = OPTIONS,
    cursor_color = "yellow",
    title_color = "light_green", # colors all lines of title
    options_color = [
        "magenta", # colors options[0]
        "light_cyan", # colors options[1]
        (192, 11, 168) # colors options[2]
        # option[3] color is not specifed so it will be considered as None
    ],
    initial_cursor_position = OPTIONS[1] # sets cursor default position to 'Option 1'
)

Metadata

Release files for python-cli-menu 1.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-cli-menu 1.8.1
File Size Uploaded Provenance Actions
python_cli_menu-1.8.1.tar.gz 7.2 kB Without provenance Details for python_cli_menu-1.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-cli-menu 1.8.1
File Interpreter ABI Platform Actions
python_cli_menu-1.8.1-py3-none-any.whl Python 3 none any Details for python_cli_menu-1.8.1-py3-none-any.whl

Total release size: 15.0 kB

Release files / python_cli_menu-1.8.1.tar.gz

Download URL python_cli_menu-1.8.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
29221fcda941a4cf68b2081d7b16dc88d8ea09cd776fe1e5c2868bf3bc1e9089
BLAKE2b-256 checksum
How to use checksums
036171ce1244ebcb3a9877f1a5df635c38add766a443f87f14237671f0eb2213
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / python_cli_menu-1.8.1-py3-none-any.whl

Download URL python_cli_menu-1.8.1-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5210f10f9a19d8a885df603c939d52cdb070af687084d26dde66bfac649949d
BLAKE2b-256 checksum
How to use checksums
58395f3561e07f522923a3d3de289b0d648820b2b8e73dc68063622be0983b57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for python-cli-menu 1.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page