Priting Out in COLOURS

  • Thread starter Satish Chimakurthi
  • Start date
S

Satish Chimakurthi

Hi All,

This must be a simple thing to do, but am not sure about it. I like to know how I can print my statements out, in colour.

Example: print 'PYTHON IS VERSATILE'

By default, this statement prints out in BLACK. What if I need to change it's colour ??


Thanks in advance

Regards,
Satish


SATISH KUMAR CHIMAKURTHI
Graduate Research Assistant
CFD GROUP
Mechanical Engineering
UNIVERSITY OF KENTUCKY
Lexington
KENTUCKY - 40508
U.S.A

Email: (e-mail address removed)
Mobile:859-420-9890
Office: 859-257-6336 X 80691
 
J

Jorge Godoy

Hi All,

This must be a simple thing to do, but am not sure about it. I like to
know how I can print my statements out, in colour.

Example: print 'PYTHON IS VERSATILE'

By default, this statement prints out in BLACK. What if I need to change
it's colour ??

Here it prints out in white, but this is how the terminal comes configured
to.

To use colors you can try printing ANSI codes to an ANSI enabled terminal or
use some module that will do the hardwork for you. NCurses come to my
mind...
 
D

Donn Cave

"Satish Chimakurthi said:
This must be a simple thing to do, but am not sure about it. I like to know
how I can print my statements out, in colour.

Example: print 'PYTHON IS VERSATILE'

By default, this statement prints out in BLACK. What if I need to change it's
colour ??

Well, you can make it as complicated as you want, but
the basic color sequence for ANSI terminals is like
'\033[NNm', where NN is 30..37 Use '\033[m' to return
to normal color.

Donn Cave, (e-mail address removed)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top