Efficient high-speed improvement of Python's input systems (using Rust)
- Flexible input function
- Prefixes and suffixes
- Masking
- Allow specific characters
- Selection (combobox)
- Select between multiple options
- Spinbox
- Install
better_input
from PyPi:
python -m pip install better_input
- Import it into your projects
import better_input
or alternatively,
from better_input import *
- Clone this repository
- Install the Python module
maturin
(preferably in a venv)
python -m pip install maturin
- Develop the project
maturin develop
- Import and use the module
import better_input
- Build the project
maturin build
Wheels are located at taret/wheels
Note that it is safe to override Python's built-in input function, it will not break code.
from better_input import input
import string
pw = input(prefix="Enter password: ", mask="•")
print(f"Password: {pw}")
age = input(prefix="Age: ", suffix=" years old", allow=string.digits)
print(f"Age: {age}")
from better_input import selection
grade = selection(
["A*", "A", "B", "C", "D", "E", "F", "U"],
prefix="Select grade:",
suffix="Student 4/30"
)
print(f"Selected grade: {grade}")
from better_input import spinbox
minutes = spinbox(
0,
3600,
prefix="Minutes: ",
suffix=" mins",
step=30,
)
print(f"Minutes: {minutes}")