0

Possible Duplicate:
Print in terminal with colors using python?

Just curious

So I want to print 'Blah' in red how do i do this.

I only want to change the color of that statement.

Community
  • 1
  • 1
jimbob
  • 461
  • 2
  • 8
  • 17
  • oh so i have a program and that one single statement should be red – jimbob Aug 18 '11 at 18:10
  • _If_ this is non-windows, world, see http://en.wikipedia.org/wiki/ANSI_escape_code http://pypi.python.org/pypi/colorama and http://bmistudents.blogspot.com/2006/08/ansi-escape-codes-in-python.html – Kimvais Aug 18 '11 at 18:12
  • It is probably easier, at least in windows, to give the program a GUI with something like QT where you can control the color and every other aspect of the display relatively easily. – TimothyAWiseman Aug 18 '11 at 18:17

2 Answers2

1

You need ANSI Colors, for your command line. But this isn't always supported by the computer.

With a litle bit of looking around on the web, I found this helpful link: http://linux.byexamples.com/archives/184/print-text-in-colors-with-a-simple-command-line/

evotopid
  • 5,288
  • 2
  • 26
  • 41
1

This will print red text in Terminal on OSX:

print '\033[91mWARNING\033[0m'
JeremyFromEarth
  • 14,344
  • 4
  • 33
  • 47