[Tutor] Changing text colors on WinXP py2.6.2

Tim Golden mail at timgolden.me.uk
Tue Oct 13 12:34:15 CEST 2009

Katt wrote:
> Is it possible to change text color on a WinXP system by just using the Ansi 
> escape codes.  I have tried, but it just shows the start and end text of the 
> code, but it doesn't change the color.

No. ANSI escapes don't work on Windows. Depending on where
you want to go, you can look at the win32console module [1]
of the pywin32 package [2] or Fredrik Lundh's console [3] 
module or Chris Gonnerman's wconio [4].


[1] http://timgolden.me.uk/pywin32-docs/win32console.html
[2] http://sourceforge.net/projects/pywin32/
[3] http://effbot.org/zone/console-index.htm
[4] http://newcenturycomputers.net/projects/wconio.html

More information about the Tutor mailing list