[Tutor] Changing the color of text in the windows shell (WinXP/python 2.6.2)

Katt the_only_katala at verizon.net
Thu Oct 15 06:46:47 CEST 2009

Hello All,

> Message: 4
> Date: Wed, 14 Oct 2009 18:38:31 +0100
> From: "Alan Gauld" <alan.gauld at btinternet.com>
> To: tutor at python.org
> Subject: Re: [Tutor] PyWin32 - Library of functions to interact with
> windows?
> "Katt" <the_only_katala at verizon.net> wrote
>> Now I find myself scratching my head and saying to myself: "now what?"
> Good question. Why did you download and install it?
> Did you have a specific need or did it just seem like a good idea at the
> time?

I installed the pywin32 as to use the color changing capacity.

> Except for the Pythonwin editor which is far superior to IDLE IMHO.
> Definitely have a play with that.

Actually I am using "Programmer's Notepad" to create my python scripts.

> HTH,

Thanks both to Alan G. and Scott N. and Kent J. for your responses.  I think 
that I will eventually learn all aspects of python programming (if I am 
lucky).  So I will pursue all three types of changing color.

First I will try WConio, next to be followed by EasyGUI, and last as Scott 
has pointed out the more difficult pywin32.

Below please find my first basic attempt at using the WConio:

from WConio import textcolor

apples_left = 5

print "There are",(textcolor(4)),apples_left,(textcolor(7)),"left in the 

The output works, but there is one snag.  I think that I am leaving 
something out because it has the word "None" on both sides of the variable.

There are None 5 None left in the basket.

I tried both textcolor(4 | 0) and textcolor (4,0).  The first has no change 
and the second has an error:

Traceback (most recent call last)
    File "changecolor.py", line 6, in <module>
        print "There 
are",(textcolor(4,0)),apples_left,(textcolor(7,0)),"left in the basket."
SyntaxError: invalid syntax

Could someone let me know what I am missing?

Thanks in advance,


More information about the Tutor mailing list