Pick Up the Pen and Add Color
Move without drawing, change colors and line thickness, and fill your shapes with bright color. Your drawings are about to come alive.
You can draw any shape now — but everywhere the turtle goes, it leaves a line, and it’s all one boring color. Today you fix both: lift the pen to make separate shapes, and add color to bring drawings to life.
Adding color and thickness
Two instructions make a big difference right away:
t.color("red")— draw in red. Try"blue","green","purple","orange","hotpink","teal"…t.pensize(8)— set the line thickness. Bigger number, thicker line.
Try it 🎯
- Change the color to your favorite.
- Change
pensize(8)topensize(20). Whoa, chunky! - Add
t.right(90)and anothert.forward(150)to make a thick, colorful corner.
Lifting the pen
The turtle holds a pen, and you can lift it up to move without drawing, then put it back down:
t.penup()— lift the pen (moving leaves no line).t.pendown()— put it back (drawing again).
Watch the turtle draw, hop across a gap, and draw again:
Two separate lines with a gap, because the pen was up in the middle. This is how you make shapes that aren’t connected.
Predict it 🔮
The code below lifts the pen, moves, forgets to put it back down, then tries to draw. Guess what shows up before you Run:
(Almost nothing past the first line! The pen never came back down, so the last moves draw nothing. Add t.pendown() before the last line to fix it.)
Filling a shape with color
To color the inside of a shape, wrap the drawing between t.begin_fill() and t.end_fill(), and pick a fillcolor:
A solid gold triangle! Everything drawn between begin_fill and end_fill gets filled in.
Try it 🎯
- Change
"gold"to another color. - Change the three
forward(100)toforward(160)for a bigger triangle. - Add
t.color("black")andt.pensize(4)at the top for a bold outline around the fill.
Your mission 🚀
Draw two separate filled shapes in different colors — for example a red square on the left and a blue triangle on the right. Use penup/pendown to hop between them. Here’s a start with the first shape:
What you learned today
t.color("name")sets the color;t.pensize(n)sets the thickness.t.penup()andt.pendown()let you move without drawing — for separate shapes.t.begin_fill()…t.end_fill()fills a shape, usingt.fillcolor("name").
Next time we put this whole week together into a real picture: a house with colored walls and a roof. 🏠🐢
Comments