kid wants to know more about color on the screen

Lee Harr missive at frontiernet.net
Sat Jun 12 15:27:13 CEST 2004


On 2004-06-12, Doug Mitchell <jmjm at SsYyMmPpAaTtIiCcOo.ca> wrote:
> 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?
>


It sounds like maybe you are using a "highlighting" text editor. That means
the text editor adds color depending on the syntax of the colored text.
For instance, if you have

print "Game Over"

in the editor, the word "print" might be blue because it is a python keyword
and the "Game Over" might be orange because it is a string.

It is also possible that the book is doing something similar and coloring
the different words to show more information about their purpose or meaning.

If you then run that program in the normal text terminal it would just print
out in whatever color the terminal happens to be (in my case green text on
a black background).

If you want to make the text a particular color, you would need to tell python
how to change the color, and that is going to take some more work.

You may want to join the tutor mailing list which is set up specifically to
help people who are brand new to python and/or programming.

http://mail.python.org/mailman/listinfo/tutor




More information about the Python-list mailing list