Changing TEXT color from python

Discussion in 'Python' started by GujuBoy, Apr 4, 2005.

  1. GujuBoy

    GujuBoy Guest

    so i am writing a program in Python and i want to print out a few
    statements in Different colors

    for example "Print hello world in RED, and "GOOD BYE in blue" "

    how can i do this...and hopefully without including any external
    modules.

    thanks in advance
     
    GujuBoy, Apr 4, 2005
    #1
    1. Advertising

  2. On 2005-04-04, GujuBoy <> wrote:

    > so i am writing a program in Python and i want to print out a few
    > statements in Different colors
    >
    > for example "Print hello world in RED, and "GOOD BYE in blue" "
    >
    > how can i do this...


    Depends on what you're printing on.

    tty?
    curses
    os.popen('tput')

    printer?
    reportlab

    > and hopefully without including any external modules.


    I suppose you can pick an output device and hard-wire the
    escape sequences into your code.

    --
    Grant Edwards grante Yow! SHHHH!! I hear SIX
    at TATTOOED TRUCK-DRIVERS
    visi.com tossing ENGINE BLOCKS into
    empty OIL DRUMS...
     
    Grant Edwards, Apr 4, 2005
    #2
    1. Advertising

  3. Am Montag, 4. April 2005 21:59 schrieb GujuBoy:
    > how can i do this...and hopefully without including any external
    > modules.


    It depends.

    Under *NIX, have a look at the curses module.

    Under Windows, Google for ANSI.SYS and read up on Escape Sequences, or check
    out the curses for Windows implementation that's floating around somewhere on
    the net, I don't know the URL.

    HTH!

    --
    --- Heiko.
    listening to: Nine Inch Nails - Somewhat Damaged
    see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (GNU/Linux)

    iD8DBQBCUZ+Tf0bpgh6uVAMRAuTiAJ9v3DSCOVGziKW2nB2QgEAf3SIl3wCeO9LZ
    jmQn1iCNFUvZIr/u1W7ByXc=
    =FvM8
    -----END PGP SIGNATURE-----
     
    Heiko Wundram, Apr 4, 2005
    #3
  4. In <>, Heiko Wundram
    wrote:

    > Am Montag, 4. April 2005 21:59 schrieb GujuBoy:
    >> how can i do this...and hopefully without including any external
    >> modules.

    >
    > It depends.
    >
    > Under *NIX, have a look at the curses module.
    >
    > Under Windows, Google for ANSI.SYS and read up on Escape Sequences, or check
    > out the curses for Windows implementation that's floating around somewhere on
    > the net, I don't know the URL.


    At least under Linux the ANSI color escapes should work too. Out of the
    box.

    Ciao,
    Marc 'BlackJack' Rintsch
     
    Marc 'BlackJack' Rintsch, Apr 4, 2005
    #4
    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. Matt Adams
    Replies:
    0
    Views:
    908
    Matt Adams
    Aug 26, 2003
  2. Richard
    Replies:
    3
    Views:
    509
    ghoul-cow
    Dec 22, 2005
  3. Alpha
    Replies:
    3
    Views:
    566
    Mabden
    Oct 5, 2004
  4. Kamaljeet Saini
    Replies:
    0
    Views:
    463
    Kamaljeet Saini
    Feb 13, 2009
  5. Replies:
    7
    Views:
    393
    Mick White
    Feb 2, 2005
Loading...

Share This Page