Nanfeng

Notes on software development, code, and curious ideas

Drawing a Strawberry Bear with Python Turtle

Finished strawberry bear

Python’s built-in turtle module is a convenient way to learn coordinate-based drawing. A complex character becomes manageable when it is split into circles, arcs, filled polygons, and repeated decorative elements.

Set up the canvas

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import turtle as t

t.setup(800, 700)
t.bgcolor("#f8d7df")
t.speed(0)
t.hideturtle()
t.tracer(False)

def move(x, y):
t.penup()
t.goto(x, y)
t.pendown()

def filled_circle(x, y, radius, color):
move(x, y - radius)
t.setheading(0)
t.color(color)
t.begin_fill()
t.circle(radius)
t.end_fill()

Build the bear from layers

Draw the body first, then the head, ears, muzzle, eyes, and nose. Later shapes naturally cover earlier outlines:

1
2
3
4
5
6
7
8
9
10
11
pink = "#d97087"
dark = "#4b3034"

filled_circle(0, -125, 145, pink) # body
filled_circle(0, 95, 175, pink) # head
filled_circle(-125, 215, 65, pink) # left ear
filled_circle(125, 215, 65, pink) # right ear
filled_circle(0, 45, 72, "#efb4ba")
filled_circle(-58, 115, 14, dark)
filled_circle(58, 115, 14, dark)
filled_circle(0, 72, 19, dark)

Add strawberries as red filled shapes with green leaves. Put repeated drawing logic in a function so position and scale can vary without duplicating hundreds of commands.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def strawberry(x, y, scale=1):
move(x, y)
t.setheading(-60)
t.color("#d7354f")
t.begin_fill()
for _ in range(3):
t.forward(42 * scale)
t.left(120)
t.end_fill()
filled_circle(x, y + 8 * scale, 5 * scale, "#4d9a55")

strawberry(-95, -75, 0.8)
strawberry(90, -110, 0.65)

t.update()
t.done()

The exact appearance depends on coordinates, line widths, and the order of shapes. Adjust one group at a time, call t.update() after the complete frame for faster rendering, and keep the window open with t.done().

+