Operation Manual
Experiments in Python
75
Notes:
You should now have a display on the screen, which has a surface of 500 x 500
tiny dots, or “pixels”. That’s a grand total of 250,000 pixels. Let’s change all
250,000 pixels to a deep blue colour using that “deepblue” tuple we created.
>>> surface.ll(deepblue)
You have filled the surface with the blue colour, but nothing will happen on screen.
The computer does not know you have finished drawing things to the surface, so
it doesn’t do anything just yet. Let’s tell PyGame that it can update the display
with this command:
>>> pygame.display.update()
You’ll now have a blue surface in your displayed window. So, that was either fun,
okay or really dull. Let’s hope it was at least okay.
How about using the other colour? Type:
>>> surface.ll(mintcream)
>>> pygame.display.update()
Hey... that’s rather plain.
Update your screen to
make the deep blue fill
you created appear.
Update your screen
again to make the your
mint cream fill appear.
Tip...
Pixel is the
short form of
“picture element”.
In programming,
a pixel can be set
to any colour you
like, and your
“screen” is made
up of many rows
and columns of
them, packed so
close together
that they blur
into one another
and look like a
single picture.