changing color on the command prompt

Discussion in 'Python' started by Hank, Aug 27, 2003.

  1. Hank

    Hank Guest

    Hi,

    does anyone know how to change the foreground color of the command
    prompt through python?

    For example if i was printing out an error message, I would like it to
    be red where the normal text color is white.

    Thanks
    Hank, Aug 27, 2003
    #1
    1. Advertising

  2. Hank wrote:

    > does anyone know how to change the foreground color of the command
    > prompt through python?
    >
    > For example if i was printing out an error message, I would like it to
    > be red where the normal text color is white.


    You may want to look at ipython (http://ipython.scipy.org), which does that
    (and much more).

    best,

    f
    Fernando Perez, Aug 27, 2003
    #2
    1. Advertising

  3. Hank

    Hank Guest

    Sorry I wasn't being clear enough.

    I meant the prompt for Windows operating system C:>. And by error
    messages i just mean printouts like
    print "Error in Process"

    If its just an environment variable, i should be able to change it,
    print it out and change it back to the original color right?

    Anyone know which variable i have to modify?

    Thanks



    Peter Hansen <> wrote in message news:<>...
    > Hank wrote:
    > >
    > > does anyone know how to change the foreground color of the command
    > > prompt through python?
    > >
    > > For example if i was printing out an error message, I would like it to
    > > be red where the normal text color is white.

    >
    > The question is underspecified/unclear.
    >
    > 1. What operating system?
    >
    > 2. By "command prompt", do you just mean the console, where text appears,
    > or do you really mean the *prompt* for the operating system, which under
    > Linux is usually something like "[user@host]#" and which under Windows
    > is usually something like "C:\>"?
    >
    > 3. Now you mention error messages... that implies you just mean changing
    > the color of your program's output.
    >
    > If you mean the actual *prompt*, you need to change the right environment
    > variable, which usually needs a separate script.
    >
    > If you mean the console text color, check the archives for the last couple
    > of days for responses to a similar question (search for "ansi.sys" perhaps).
    >
    > -Peter
    Hank, Aug 28, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chrisdude911
    Replies:
    10
    Views:
    135,372
    srk289
    Mar 10, 2009
  2. gaurav kashyap
    Replies:
    2
    Views:
    613
    gaurav kashyap
    Oct 30, 2008
  3. gaurav kashyap
    Replies:
    3
    Views:
    683
    gaurav kashyap
    Oct 31, 2008
  4. Mel
    Replies:
    10
    Views:
    3,111
    Sailaja Appi
    Feb 13, 2009
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    403
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page