Editor

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.

Smiley Face in Python Turtle: the finished drawing
import turtle
screen = turtle.Screen()
screen.bgcolor("lightskyblue")
screen.title("Smiley face")
t = turtle.Turtle()
t.speed(6)
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: 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()
# Two eyes
draw_eye(-65, 55)
draw_eye(65, 55)
# Pink cheeks
t.goto(-115, -25)
t.dot(55, "lightpink")
t.goto(115, -25)
t.dot(55, "lightpink")
# 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)
t.hideturtle()
turtle.done()

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) and t.circle(-110, 120).
  • Change t.color("darkorange", "gold") to t.color("green", "lightgreen") for a green face.
  • Make the eyes bigger by changing t.dot(48, "black") to t.dot(60, "black").

What it uses

Every turtle command the site supports is listed on Python turtle online.