kid wants to know more about color on the screen

Sean Berry sean_berry at cox.net
Sun Jun 13 02:06:53 EDT 2004


"Doug Mitchell" <jmjm at SsYyMmPpAaTtIiCcOo.ca> wrote in message
news:FMCyc.61975$8k4.1338501 at news20.bellglobal.com...
> Dear Group,
>
> My son who is in grade 7 has *just* started going through the book "Python
> for the Absolute Beginner" by Michael Dawson. He and I have no programming
> experience. He is beginning this on an old win 95 computer with Python 2.2
I
> think.
>
> He is getting a bit frustrated with color coding.
> For example in Chapter 2 page 18 and 19 Mr. Dawson describes a more fancy
> way of printing "Game Over" on the screen.  According to *him*...
>
> When I type the command:     print "Program 'Game Over' 2.0"
>                                               print \
>
> Instead of getting the second "print" to turn orange, like it's supposed
to
> when you type in a command, it just stays black. And when its time to
> actually run the program, Python just prints out Program Game Over 2.0
> instead of the fancy large text like that is shown in the book.
>
> Later on he says that strings within quotes will be green as expected and
> then all of a sudden on the next line it will stay black :(. And when he
> does a run script there will be a syntax error as Python wont recognize
this
> 'black' string but then on another occasion the 'black' will run ok :(.
>
> I am sure my inquiries are quite vague but I am trying to piece together
> some of his 'groans and grunts' :(.
>
> Any suggestions or other info you need from him?
>
> Thanks for your advice.
>
> Jack
>
>



As previously mentioned... the author is not referring to the color of the
output of the code, but rather the color of the code itself.

If you are using python on a Windows machine then the way to get the text to
hightlight is to save it as a *.py file... like test.py.  Without the .py at
the end the text highlighting will not work.

Once it is saved as a .py file... the following types of rules will apply.

# this entire line is red because it is a comment

"this text is green becuase it is a string in quotes"

print "Some stuff"  <-- "print" is orange because it is a python keyword.

def this:  <-- "this" is blue becuase it is the name of a function


I hope this helps.





More information about the Python-list mailing list