Re: How to Add ANSI Color to User Response

Liste des GroupesRevenir à cl python 
Sujet : Re: How to Add ANSI Color to User Response
De : bouncingcats (at) *nospam* gmail.com (David)
Groupes : comp.lang.python
Date : 11. Apr 2024, 04:24:59
Autres entêtes
Message-ID : <mailman.92.1712802339.3468.python-list@python.org>
References : 1 2
On Wed, 10 Apr 2024 at 18:51, WordWeaver Evangelist via Python-list
<python-list@python.org> wrote:

I have a simple question. I use the following textPrompt in some of my
Jython modules:

 '\n [1;33mYour 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?

Hi Bill,

Here's a tutorial:
  https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
Note the sentence: "once you print out the special code enabling a color,
the color persists forever until someone else prints out the code for
a different color, or prints out the Reset code to disable it."

Here's a more detailed specification:
  https://en.wikipedia.org/wiki/ANSI_escape_code

And here's a conversation:
  http://mywiki.wooledge.org/BashFAQ/037
(see the first sentence, and then under the heading "Discussion")
that might help you decide whether this approach will satisy your need in
your particular circumstances of operating system, Python version, and
terminal settings.

Date Sujet#  Auteur
11 Apr 24 o Re: How to Add ANSI Color to User Response1David

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal