Python "input" module enhancements, such as combining colorama and updates to johejo's "inputimeout" library.
This repo was based off johenjo's inputtimeout
implementation. However, since that repo is a public archive, and there are other ways I want to handle timed-out inputs, I decided to create my own variation. In addition, this repo library also includes the employment of colorama
as optional styling. (Currently, version 0.1.0
of this library only supports text color and not background colors.)
# Install main
pip install enhanced_input@git+ssh://git@github.com/nga-27/enhanced-input.git@main
# Specific version
pip install enhanced_input@git+ssh://git@github.com/nga-27/enhanced-input.git@v0.1.0
from enhanced_input import EnhancedInput, EnhancedInputColor
e_input = EnhancedInput()
# prompt input with default timeout (~30s)
e_input.input("What's your name? ")
# prompt input with modified timeout (5.1s)
e_input.input(">>> ", timeout=5.1)
# prompt input with modified timeout and color change (cyan)
e_input.input(">>> ", timeout=5.1, text_color=EnhancedInputColor.CYAN)