Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Changing TEXT color from python

Reply
Thread Tools

Changing TEXT color from python

 
 
GujuBoy
Guest
Posts: n/a
 
      04-04-2005
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

 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a
 
      04-04-2005
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...
 
Reply With Quote
 
 
 
 
Heiko Wundram
Guest
Posts: n/a
 
      04-04-2005
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+Tf0bpgh6uVAMRAuTiAJ9v3DSCOVGziKW2nB2QgE Af3SIl3wCeO9LZ
jmQn1iCNFUvZIr/u1W7ByXc=
=FvM8
-----END PGP SIGNATURE-----

 
Reply With Quote
 
Marc 'BlackJack' Rintsch
Guest
Posts: n/a
 
      04-04-2005
In <mailman.1316.1112645526.1799.python->, 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing font color from current font color to black color Kamaljeet Saini Ruby 0 02-13-2009 04:58 PM
Changing the text color in a text box Richard HTML 3 12-22-2005 08:29 PM
Change text color for one document.write but not color of all text? kroger@princeton.edu Javascript 7 02-02-2005 01:23 PM
Changing text color in a game Alpha C++ 3 10-05-2004 09:07 PM
Change text color of "visited link" back to unvisited color ??? Matt Adams HTML 0 08-26-2003 10:27 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57