Draw a Sailboat in Python Turtle
Intermediate · Things to draw · 81 lines · draws in about 10 seconds
Triangles from lists of points make the sails, and arcs that bend one way and then the other make the wavy lines across the sea.

How the code works
Waves from arcs
The turtle starts pointing 60 degrees up. circle(-20, 120) bends right over a crest and circle(20, 120) bends left through a dip, which leaves it pointing 60 degrees up again, ready for the next wave.
def wave_row(x, y): # A wavy line: arcs that bend right, then left, eight times t.penup() t.goto(x, y) t.setheading(60) t.pendown() for _ in range(8): t.circle(-20, 120) t.circle(20, 120)
Seagulls
Two small arcs side by side, each starting at the same heading, look like a bird far away.
def seagull(x, y): # Two small arcs side by side look like a bird far away t.penup() t.goto(x, y) t.pendown() for _ in range(2): t.setheading(60) t.circle(-12, 120)
Sails, mast and flag
Each sail is a right-angled triangle given as three points. The mast is a thick brown line from below the sails to above them, and the flag is one more small triangle.
# Two sails and the mast polygon([(10, -10), (10, 185), (150, -10)], "white") polygon([(-10, -10), (-10, 150), (-125, -10)], "orange") t.pensize(6) t.pencolor("saddlebrown") t.penup() t.goto(0, -30) t.pendown() t.goto(0, 195) t.pensize(1) # A small flag at the top of the mast polygon([(0, 195), (40, 183), (0, 171)], "crimson")
The sea in front
The hull is drawn before the sea, so the sea covers its bottom and the boat seems to float. The three rows of waves start at different x positions so they do not line up.
# The sea goes last so it covers the bottom of the boat polygon([(-300, -220), (300, -220), (300, -60), (-300, -60)], "royalblue") t.pensize(4) t.pencolor("lightcyan") wave_row(-262, -100) wave_row(-294, -145) wave_row(-262, -190)
Make it yours
Change the code above and press Run. Some ideas:
- Turn it into a sunset: change
"lightskyblue"to"lightsalmon"and the sun's"gold"to"orangered". - Change
"orange"in the second sail'spolygon()to"crimson"for a red sail. - For bigger waves, change both 20s in
wave_row()to 25 andrange(8)torange(6).
What it uses
- lists of points
- circle with an extent
- functions with parameters
- drawing order
Every turtle command the site supports is listed on Python turtle online.