fuellen
Deutsch   English   

4. FILL FIGURES

 

 

YOU LEARN HERE...

 

that the Turtle can remember its movement in order to fill a closed figure drawn by it with a color.

 

 

EXAMPLES

 

To fill a figure, you first tell the Turtle with startPath() that it should remember the figure drawn next, starting from the current location. With the fillPath() function, the current location is connected to the start location and the enclosed area is colored. With setFillColor() you can specify the fill color (if you say nothing, it is black by default). If you do not want visible outlines, you must also set the pen color to “magenta”.

Program:    

from gturtle import *

setFillColor("magenta")
setPenColor("magenta")
startPath()
repeat 5:
    fd(160)
    rt(144)
fillPath()
► Copy to clipboard
 

 

CIRCLE AS POLYGON

You can use the Turtle to draw a filled circle as a polygon with many sides. If you do not want visible outlines, select the same pen and fill color as before.

Program:    

from gturtle import *

setFillColor("lime")
startPath()
repeat 120:
    forward(3)
    right(3) 
fillPath()
hideTurtle()
► Copy to clipboard
 

 

 

TO SOLVE BY YOURSELF

 
1.

To draw the adjacent 6-pointed star, rotate the turtle alternately 140 and 80 degrees.

 

2.
Draw two filled semicircles. If you hide the turtle with hideTurtle(), the picture will be drawn much faster.  


3.


This funny figure consists of filled and unfilled circles. Draw it with polygons as in the pattern example.

 


4

Draw the adjacent picture.

 

 

5.

To draw a red cross, use one or two repeat loops.