Learning goals
- Fill a shape with color.
- Choose a fill color and a background color.
- Explain the difference between
pencolor(),fillcolor()andcolor().- Explain when Turtle fills a shape.
Look at this example. It draws and fills a circle.
import turtle as otto
otto.color("black")
otto.begin_fill()
otto.circle(50)
otto.end_fill()

The fill is the color inside a shape. otto.begin_fill() marks where filling starts. otto.end_fill() completes the shape and fills it.
Yes. You can fill every closed shape. A closed shape ends where it started, so it has no gap.
You already know how to draw a square with forward() and left().
Put those commands between begin_fill() and end_fill():
import turtle as otto
otto.color("green")
otto.begin_fill()
otto.forward(80)
otto.left(90)
otto.forward(80)
otto.left(90)
otto.forward(80)
otto.left(90)
otto.forward(80)
otto.left(90)
otto.end_fill()
What do you think the turtle will draw? Think first, then look at the animation.

The turtle draws a green square. At end_fill(), it fills the inside green.
In the examples above, otto.color() gave the line and the inside the same color. You can also choose two different colors:
otto.pencolor() sets the pen color: the color of the line.otto.fillcolor() sets the fill color: the color inside the shape.import turtle as otto
otto.pencolor("blue")
otto.fillcolor("orange")
otto.begin_fill()
otto.circle(50)
otto.end_fill()
Which colors will the circle get? Think first, then look at the animation.

The line is blue and the inside is orange.
pencolor(), fillcolor() and color()?Now you know three commands for colors. This table compares them:
| Command | Line color | Fill color |
|---|---|---|
otto.pencolor("blue") |
blue | stays the same |
otto.fillcolor("orange") |
stays the same | orange |
otto.color("green") |
green | green |
Use otto.bgcolor() to set the color behind the drawing. This example makes an orange circle on black.
import turtle as otto
otto.bgcolor("black")
otto.color("orange")
otto.begin_fill()
otto.circle(50)
otto.end_fill()

Try it yourself: Click the Run button. The drawing appears below the code.
Then choose your own background color and circle color. Click Run again.
import turtle as otto
otto.bgcolor("black")
otto.color("orange")
otto.begin_fill()
otto.circle(50)
otto.end_fill()
| Command | What it does |
|---|---|
otto.begin_fill() |
Marks where filling starts. |
otto.end_fill() |
Finishes the shape and fills its inside. |
otto.pencolor(color) |
Sets only the line color, for example "blue". |
otto.fillcolor(color) |
Sets only the inside color, for example "yellow". |
otto.color(color) |
Sets the line color and the inside color. |
otto.bgcolor(color) |
Sets the background color, for example "blue". |