A Python module that extends the basic input function with 16 different parameters and many combinations.
Project description
CinPlus
CinPlus (short for Console Input Plus) is a Python module that extends the basic input function with 16 different parameters and many combinations. It is inspired by pwinput and many other modules. It helps enhance user input experience.
Installation
To use the CinPlus module, simply execute this command on your terminal:
pip install cinplus
Function Parameters
def custominput( # This is the main function.
text: str = "", # The prompt for the input.
limit: int = None, # Maximum amount of characters.
exact: bool = False, # Does the length of the input have to be the same as the limit?
masked: bool = False, # Will the input be hidden with a mask?
mask: str = "*", # The mask to hide the input with. Only used if `masked` parameter is set to True.
clear: bool = True, # Will there be a shortcut key to clear the input?
cvk: int = 24, # The shortcut key in ASCII code to clear the input with. Only used if `clear` parameter is set to True. Default key is Ctrl+X.
case: str = None, # Is the input case-sensitive?
color: tuple = (
192, # R(ed)
192, # G(reen)
192, # B(lue)
), # The RGB color for the prompt. Only supported on terminals with 24-bit True Color support.
incolor: tuple = (
192, # R(ed)
192, # G(reen)
192, # B(lue)
), # The RGB color for the input. Only supported on terminals with 24-bit True Color support.
interrupt: bool = True, # Will Ctrl+C break the loop?
ivk: int = 3, # The shortcut key in ASCII code to break the input with. Only used if `interrupt` parameter is set to True. Default key is Ctrl+C.
rki: bool = False, # Raise a KeyboardInterrupt when interrupted. Only used if `interrupt` parameter is set to True.
empty: bool = False, # Will it check if the string is empty?
pattern: str = None, # The Regex pattern to match the input with.
strip: bool = False, # Will it remove any whitespaces in the input?
)
Usage Example
import cinplus
cinplus.custominput(
"Enter your password: ", # The prompt
8, # Max characters: 8.
True, # Input length has to be equal to limit.
True, # Is masked (hidden).
"*", # The mask to hide each character with.
True, # Have a shortcut to clear the input.
24, # The shortcut key in ASCII code to clear the input with. Ctrl+X
'upper', # The input is uppercase-sensitive.
(255, 128, 0), # The RGB code to color the prompt with.
(0, 0, 255), # The RGB code to color the input with.
True, # Have a shortcut to break the input loop.
3, # The shortcut key in ASCII code to break the input loop with. Ctrl+C
False, # Don't raise a KeyboardInterrupt error when interrupt key pressed.
True, # Check if the input is empty.
None, # No Regex pattern to match the example with.
True, # Remove any whitespaces from the input.
)
License
This module is licensed under the Mozilla Public License 2.0. For more details, please refer to the LICENSE file.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cinplus-1.0.1.tar.gz.
File metadata
- Download URL: cinplus-1.0.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81b6c5243aba836585deda5aeeedb05869807be2698ab7d4e7cc35958f710f4b
|
|
| MD5 |
43101e0beb1706e9a9ffc5d7787a926f
|
|
| BLAKE2b-256 |
a8ca892f515d81a43839cf11ca09647db419198baec82175a4e337dc097830e8
|
File details
Details for the file cinplus-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cinplus-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
167c12f1c3d51dc667536a61b34b7ff26fb4387003a7e58f3bd759907c15d65d
|
|
| MD5 |
feb6e46a6480d16381974641776c3e65
|
|
| BLAKE2b-256 |
c138f9675ac9facfa079151bd4171d676c65a23754b6a94a5f605b13a3ee4e09
|