MultiChoice
A framework for generating well formatted user input queries in the terminal.
Table of Contents
- API Documentation
- Question: Fill-in-the-blank
- TrueFalse: True or False
- MultiChoice: Multiple Choice
- Developer Log
API Documentation
Class: Question
Question(query)
Question: Generates fill in the blank style questions.
__call__(self)
- Return: String. Returns the user selection.
__init__(self, query, required=True, cursor='>>>')
- Param query: String.
- Question for the user.
- Param required: Optional Bool. Default=True
- True: Repeats question until answered.
- False: Accepts null input as an empty string.
- Param cursor: Optional String. Default='>>>'
- Indicates user input field.
Question Example
from MultiChoice import Question
get_name = Question("What is your name?") # setup
user = get_name() # get input
print(user) # print
What is your name?
>>> Robert
Robert
Class: TrueFalse
TrueFalse(query)
TrueFalse: Generates True or False style questions.
__call__(self)
- Return: String. Returns the user selection.
__init__(self, query, required=True, cursor='>>>')
- Param query: String.
- Question for the user.
- Param required: Optional Bool. Default=True
- True: Repeats question until answered.
- False: Accepts null input as an empty string.
- Param cursor: Optional String. Default='>>>'
- Indicates user input field.
TrueFalse Example
from MultiChoice import TrueFalse
question = TrueFalse("True or False: Python3 is the best!")
answer = question()
print(answer)
True or False: Python3 is the best!
1. True
2. False
>>> 1
True
Class: MultiChoice
MultiChoice(query, options)
MultiChoice: Generates multiple choice style questions.
__call__(self)
- Return: String. Returns the user selection.
__init__(self, query, options, required=True, strict=True, cursor='>>>')
- Param query: String.
- Question for the user.
- Param options: Tuple of Strings.
- Options presented to the user as a numbered sequence.
- Numbers are generated automatically.
- The user may enter an answer as text or one of the numbers.
- Param required: Optional Bool. Default=True.
- True: Repeats question until answered.
- False: Accepts null input as an empty string.
- Param strict: Optional Bool. Default=True.
- True: Answer must be in the options tuple. Not case-sensitive.
- False: Accepts any answer.
- Param cursor: Optional String. Default='>>>'
- Indicates user input field.
MultiChoice Example
from MultiChoice import MultiChoice
question = MultiChoice(
"What is your favorite color?\n"
"You must choose one of the following:",
options=("Red", "Orange", "Yellow", "Green", "Blue", "Purple"),
)
answer = question()
print(answer)
What is your favorite color?
You must choose one of the following:
1. Red
2. Orange
3. Yellow
4. Green
5. Blue
6. Purple
>>> blue
Blue
Developer Log
MultiChoice v0.3.5
- TrueFalse update, removed strict option - T/F is always strict.
MultiChoice v0.3.4
- Installer Bug Fixed
MultiChoice v0.3.3
- Comments Updated
MultiChoice v0.3.2
- Examples Added
MultiChoice v0.3.1
- Added Cursor Option
MultiChoice v0.2 (internal)
- API Updated
MultiChoice v0.1
- Initial Upload
Metadata
Release files for MultiChoice 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| MultiChoice-0.3.5.tar.gz | 3.2 kB | Without provenance | Details for MultiChoice-0.3.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| MultiChoice-0.3.5-py3-none-any.whl | Python 3 | none | any | Details for MultiChoice-0.3.5-py3-none-any.whl |
Total release size: 6.4 kB
Release files / MultiChoice-0.3.5.tar.gz
| Download URL | MultiChoice-0.3.5.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ccd1ce6fb8029f40cdd30003bf6abbcc2f1901a956a47d6f80aa8709a101862
|
|
BLAKE2b-256 checksum How to use checksums |
37ad301f83cdfba76ad917e0431497ad6837b82c3587e7ea375b0df2cb8a629c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0
|
Release files / MultiChoice-0.3.5-py3-none-any.whl
| Download URL | MultiChoice-0.3.5-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc7ecaa0e29bfade01ad659baa1167f7757f358cbfd29282170ab1c1bd3756af
|
|
BLAKE2b-256 checksum How to use checksums |
e3aa8b4a7aa50d445537181716c5798c61aeaabe3e3997617440df3a93841de8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0
|
Security for MultiChoice 0.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.