Skip to main content

An extreamly easy to use Python console menu

Project description

PyConsoleMenu2

An extreamly easy to use, cross-platform Python console menu. (forked ver.)

Features:

  • Cross platform, interactive selection
  • Flexible Builder pattern
  • Multi selection and Callback selection support

Preview

Selector

See other

Installation 💾

pip install PyConsoleMenu2

Usage example 👨‍💻

from PyConsoleMenu2 import BaseMenu, FunctionalMenu, MultiMenu

# basic usage, get the index
ret = BaseMenu("title: BaseMenu").add_options(["a", "b", "c"]).run()
print(ret)

# get the name, and more options
ret = (
    BaseMenu("title: BaseMenu")
    .add_options(["a", "b", "c"])
    .add_option("d")
    .default_index(1)
    .prefix("[")
    .suffix("]")
    .raise_when_too_small()
    .run_get_item()
)
print(ret)

# multi selection
ret = MultiMenu("title: MultiMenu").max_count(2).add_options(["a", "b", "c"]).run()
print(ret)

# callback selection
func = (
    FunctionalMenu("title: FunctionalMenu")
    .add_option("a", lambda: print("a"))
    .add_options([("b", lambda: print("b")), ("c", lambda: print("c"))])
    .run_get_item()
)
func()

See more examples

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

pyconsolemenu2-1.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

pyconsolemenu2-1.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pyconsolemenu2-1.1.0.tar.gz.

File metadata

  • Download URL: pyconsolemenu2-1.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for pyconsolemenu2-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7d01ad807cdd9a38c0aa2e38457a504a90c7d86b88d67ef27ff433134d2334a3
MD5 8abb55233c078d5ea867d8b6356b8327
BLAKE2b-256 d72f1e5a998aac2981582a832ec24782ec327179e7d270cb4cb3853d5dfa007e

See more details on using hashes here.

File details

Details for the file pyconsolemenu2-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyconsolemenu2-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86a58c6f730d6d13fe46fd9d4bc8150a88b54c721c8dc4f6ba7a7ae82afea96b
MD5 a8395209988bf9b98f637a3fd31e931e
BLAKE2b-256 84d0fdb91b375762eaf4533ccb0c0950d731417dba61cf8255c6a13b7108d41f

See more details on using hashes here.

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