Python question: color in DOS prompt?

Hi guys!

Currently, I’m playing around with good ol’ python and I’m tired of the white color in the DOS command screen which you get when printing.
How can I get some color into it?
It’s possible in C/C++, though limited to 9 colors and you need some Windows stuff.
How can I do something like that with python?
I’m running Windows XP.


The best,


I use

print '\033[1;31mSome Red Text\033[0m'
print '\033[1;32mSome Green Text\033[0m'
print '\033[1;33mSome Yellow text\033[0m'
print '\033[1;34mSome Blue Text\033[0m'

But I don’t know if it works in windows.

I’m afraid it doesn’t. I appreciate your effort, though!
Searching the Python documentation hasn’t returned any useful results either :confused:

Xp guide:

  • start blender. (if not already)
  • focus output window.
  • click on the output window icon (titelbar)
  • choice Propertie.
    … start editing …
  • OK => choice: Save properties for future windows with same title.

If you grab ActivePython, you get access to most of the Win32 API… so you can do it similar to how you do it in C…


With some appropriate checks for what OS it’s running on, and fall back to ANSI X3.64 if it’s not running on Windows (most, if not all, Linux consoles will read ANSI).

though limited to 9 colors
Actually, 16… RGB, CMY, Black and White, with both bright and dark variants of each. You get the same 16 colours with the ANSI codes, too.

Thanks for the replies!

Does ActivePython 2.4 work in combination with Python 2.5?

Regardless of that, how can I use ActivePython in my code?
I am new to python and programming in general, so I don’t know how to import the win32console.

ActivePython is a distro of Python… if you wanted to use that, it’d be instead of the official Python distro.

Though, you may or may not be able to take the win32console module out of ActivePython and drop it into the official Python… I’m not sure… the version difference might be a problem.

So, how can I do that?
I have found the file containing the module, so what do I do with it?
I can always refer to an older version of python, if necessary, but I hope I can get it to work like this anyway.

Wrong fourm. Please use the proper support forums.