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
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()
Project details
Release history Release notifications | RSS feed
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)