Smiley Face in Python Turtle
Beginner · Shapes · 50 lines · draws in about 5 seconds
A big filled circle makes the face, dots make the eyes and cheeks, and part of a circle makes the smile.

How the code works
Eyes with a sparkle
dot(48, "black") draws a filled circle centred on the turtle, which is quicker than circle() for small round things. A small white dot up and to the right makes the eye shine.
def draw_eye(x, y): # A black eye with a small white sparkle near the top t.penup() t.goto(x, y) t.dot(48, "black") t.goto(x + 8, y + 9) t.dot(14, "white")
The face
circle(190) draws a circle to the turtle's left, starting where it stands, so the turtle first moves to (0, -190), the bottom of the face. color("darkorange", "gold") sets the outline colour and the fill colour together.
# The face: a yellow circle with an orange outline. # circle() starts at the bottom, so go down by the radius first t.penup() t.goto(0, -190) t.pendown() t.pensize(6) t.color("darkorange", "gold") t.begin_fill() t.circle(190) t.end_fill()
The smile
The smile is 120 degrees of a circle with a radius of 110. setheading(-60) points the turtle down and to the right, so the arc dips and comes back up to the same height on the other side.
# The smile: part of a circle, starting on the left and curving up to the right t.goto(-95, -20) t.setheading(-60) t.pendown() t.pensize(10) t.pencolor("saddlebrown") t.circle(110, 120)
Make it yours
Change the code above and press Run. Some ideas:
- Turn the smile into a frown: use
t.goto(-95, -80),t.setheading(60)andt.circle(-110, 120). - Change
t.color("darkorange", "gold")tot.color("green", "lightgreen")for a green face. - Make the eyes bigger by changing
t.dot(48, "black")tot.dot(60, "black").
What it uses
- circle and dot
- begin_fill and end_fill
- functions with parameters
- setheading
Every turtle command the site supports is listed on Python turtle online.