How to Add ANSI Color to User Response

Grant Edwards grant.b.edwards at gmail.com
Wed Apr 10 22:37:31 EDT 2024


On 2024-04-10, Alan Gauld via Python-list <python-list at python.org> wrote:
> On 10/04/2024 19:50, WordWeaver Evangelist via Python-list 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
>
> Normally, for any kind of fancy terminal work, I'd say use curses.

If you want to use the terminal escape sequences provided by terminfo
and ncurses, but don't want to use the ncurses windowing functions,
here are some notes on how to do that:

    https://github.com/GrantEdwards/Python-curses-and-terminfo

That too is C-Python oriented, and I don't really know how to do the
same things using Jython.

--
Grant



More information about the Python-list mailing list