Raspberry_Pi_Education_Manual

Notes:

Notes: Going round in circles

Now you have filled the background, let’s add a circle to the surface.

>>> surface.fill(deepblue) >>> position = (250,250) >>> radius = 50 >>> linewidth = 2 >>> pygame.draw.circle(surface, mintcream, position, radius, linewidth)

Tip...

Sometimes, we have more code to write than fits on one line. When you see a line of code such as the last one here, that goes onto a new line without a prompt or indent, that is really just one line of code. Don’t press Return to start a new line, just let it word wrap and Python will work it out for you.

Update again to see the circle added.

>>> pygame.display.update ()

Try changing some of the numbers for drawing the circle and see what happens. Remember to update after each circle you add to the surface.

A beginner’s guide to Scratch

77

Made with FlippingBook flipbook maker