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 details)

Uploaded Source

File details

Details for the file pychoices-0.0.3.tar.gz.

File metadata

  • Download URL: pychoices-0.0.3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for pychoices-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0e08dc6facf98aad879d05cf10084460e99964c77d8cabcf467b059da78281a2
MD5 5dc6ee5deba2605528eb8d10a32c23e0
BLAKE2b-256 99b500e9f8e78db353fa867e9fc26ae13bfb82c2c7a478861833eb2a3afc911a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page