Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pychoices-0.0.3.tar.gz (3.0 kB view hashes)

Uploaded Source

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