Tools to help with text mode (i.e. non-GUI) input
dn
PythonList at DancesWithMice.info
Sat Jan 11 19:49:03 EST 2025
On 12/01/25 03:28, Chris Green via Python-list wrote:
> I'm looking for Python packages that can help with text mode input,
> i.e. for use with non-GUI programs that one runs from the command
> prompt in a terminal window running a bash shell or some such.
>
> What I'm specifically after is a way to provide a default value that
> can be accepted or changed easily and also a way to provide a number
> of different values to choose from.
>
> I.e. for the default sort of input one might see:-
>
> Colour? red
>
> Hitting return would return 'red' to the program but you could also
> backspace over the 'red' and enter something else. Maybe even better
> would be that the 'red' disappears as soon as you hit any key other
> than return.
>
>
> For the select a value type of input I want something like the above
> but hitting (say) arrow up and arrow down would change the value
> displayed by the 'Colour?' prompt and hitting return would accept the
> chosen value. In addition I want the ability to narrow down the list
> by entering one or more initial characters, so if you enter 'b' at the
> Colour? prompt the list of values presented would only include colours
> starting with 'b' (beige, blue, black, etc.)
>
>
> Are there any packages that offer this sort of thing? I'd prefer ones
> from the Debian repositories but that's not absolutely necessary.
>
>
> It might also be possible/useful to use the mouse for this.
There must be more choices/combinations of packages to do this. Maybe a
good place to start is the Python Prompt Toolkit
(https://python-prompt-toolkit.readthedocs.io/en/master/)
--
Regards,
=dn
More information about the Python-list
mailing list