How to Add ANSI Color to User Response

Grant Edwards grant.b.edwards at gmail.com
Wed Apr 10 15:53:20 EDT 2024


On 2024-04-10, WordWeaver Evangelist via Python-list <python-list at python.org> wrote:

> I have a simple question. I use the following textPrompt in some of my Jython modules:
>  '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, forceUppercase=True)

> Is there a way to add an ANSI color code to the end where the
> conditions are, so that the color of the user’s input is of a color
> of my choosing, instead of just white?

I'm not sure what is meant by "the end where the conditions are", nor
do I know what "textPrompt" refers to.

Are you asking how to put a second escape sequence at the end of the
string literal after the colon?

--
Grant






More information about the Python-list mailing list