Small Python library for receiving choice input from user.
Project description
PyChoices
A very small Python library for receiving choice input from your user.
Installing
pip3 install pychoices
Quickstart
import pychoices
result = pychoices.ask("Squirtle", "Charmander", "Bulbasaur", label="Choose your Starter!")
print(result)
#(0, "Squirtle") or (1, "Charmander") or (2, "Bulbasaur")
What It Does
PyChoices will clean the terminal and display the options provided in the args.
The user can change the answer by using the up and down arrows.
Then, by pressing enter, the option will be defined as selected and the function will finish by returning a tuple.
Reference
function ask(*args, **kwargs)
args is the array of choices available for the user. kwargs is a dictionary of options for customizing the ask function, the available options are:
- label: a string that will be printed along with the choices
- color: one of the options in the COLORS class, will be the color of the current activated option.
class Colors
Class holding some constant values of colors and styles for using in the ask function, the available colors are:
- HEADER: Purple
- OKBLUE: Blue
- OKGREEN: Green
- WARNING: Yellow
- FAIL: Red
- BOLD: Bold
- UNDERLINE: Underlined
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.