Color Wheel Wedges¶
By the end of this lab you'll be able to:
- Divide 360° into equal wedge angles using
360 / n - Draw filled pie-slice shapes using
begin_fill()with forward and turn commands - Understand how the 12 hues of the color wheel relate to each other
Twelve filled wedges radiate from the center, each one a different hue — red, orange, yellow, green, blue, violet, and all the steps between.
Welcome to the Color Wheel!
In this lab you'll discover how to draw filled pie slices and how all 12 pure hues
fit perfectly around a circle. Let's code it together!
How the Wedges Work¶
Each wedge is a triangle: two long sides from the center and a short arc closing the tip. We approximate the arc by drawing several small forward steps while turning slightly.
The 12 hues used are the standard color wheel: red, orange, yellow, chartreuse,
green, springgreen, cyan, deepskyblue, blue, purple, magenta, deeppink.
Sample Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
What Do You Think Will Happen?
Each wedge spans 360 / 12 = 30°. How many wedges will fit in a full circle?
Make your guess — then click Run to find out!
Try It Now¶
Exactly 12 wedges — one per hue, each 30°, summing to 360°. Were you right?
How It Works¶
Each wedge is drawn as a filled, triangle-like slice: go out along one edge, trace the small arc that rounds the rim, then come back along the other edge to the center.
Two turns at the end do the important work. monty.left(180 - wedge) undoes the turning Monty built up while drawing the slice, pointing him back along the direction he started this wedge in. Then monty.left(30) — the line that makes the wheel actually spread out — rotates him one wedge angle so the next slice is drawn 30° further around. Twelve slices × 30° = 360°, one full circle.
Explanation Table¶
| Line | What it does |
|---|---|
hues = [...] |
List of 12 standard color wheel hues |
wedge = 360 / 12 |
Each slice spans 30° |
monty.forward(radius) |
Draw the first edge of the wedge outward |
for _ in range(6) |
Approximate the rim arc with 6 short forward+turn steps |
monty.forward(radius) |
Draw the second edge back to center |
monty.left(180 - wedge) |
Undo the slice's turning, back to its starting direction |
monty.left(30) |
Rotate one wedge (30°) to the next slice |
A Shorter Way: Using circle()¶
Drawing the rim with six tiny forward/left steps showed us how an arc is
built. But Python turtles also have a built-in circle() command that draws an
arc for us: monty.circle(radius, wedge) curves through wedge degrees along a
circle of the given radius. That single line replaces the whole inner loop —
everything else stays exactly the same, including the two turns that rotate
Monty to the next slice.
What Do You Think Will Happen?
This program is shorter, but it does the same job. Will it draw the same
12-color wheel, a smaller one, or a completely different shape?
Predict, then click Run.
Same wheel, fewer lines! Because circle() lands Monty exactly on the rim, this
version even returns precisely to the center on every slice. Use whichever method
you like — the hand-drawn loop when you want to see the arc being built, and
circle() when you just want a clean curve in one line.
Learning Check¶
Your Turn — One Variable Controls the Wheel
This version stores the slice count in a variable, wedges, and computes
angle = 360 / wedges from it — so one number sets the wedge width, the rim,
and the rotation together. Predict what the wheel will look like with
wedges = 5, then run it to find out!
Run it: wedges = 5 makes each slice 72°, and five slices already fill the circle — so the sixth color (magenta) laps the wheel and paints over the first (red), leaving five visible slices. Pulling the count into a variable makes re-scaling easy: angle = 360 / wedges drives the wedge width, the circle(radius, angle) rim, and the monty.left(angle) turn all at once. Keep wedges equal to the number of colors in hues and every hue gets its own clean slice.
Experiments¶
-
Try 8 wedges. Use 8 colors, change
360 / 12to360 / 8, adjust the inner arc to 4 steps × 11.25°, and change the closing rotation tomonty.left(45). You'll know it worked when 8 equal slices fill the circle. -
Tilt the whole wheel. Add a single
monty.left(15)line just before theforloop. You'll know it worked when the entire wheel is rotated 15° but still closes into a full circle. -
Shrink alternate wedges. Use
for i, hue in enumerate(hues):, then setr = radiusfor eveniandr = radius // 2for oddi. Userin bothforward(...)lines and in the arc stepforward(r * 0.1). You'll know it worked when long and short wedges alternate around the wheel.
Spectacular!
You drew all 12 hues of the color wheel and learned how 360 / n divides
a circle into any number of equal slices. Artists use this same wheel every day!
Up next: Pentagon Chain to practice the polygon angle formula.