Functions: There’s a Name for That 167
t.begin_fill()
t.circle(10)
t.end_fill()
Right eye
t.setpos(x+15, y+60)
t.begin_fill()
t.circle(10)
t.end_fill()
Mouth
t.setpos(x-25, y+40)
t.pencolor("black")
t.width(10)
t.goto(x-10, y+20)
t.goto(x+10, y+20)
t.goto(x+25, y+40)
t.width(1)
turtle.onscreenclick(draw_smiley)
Now, instead of drawing random smiley faces all over the
screen, the user can draw a smiley face wherever they click the
mouse; they can even draw a big smiley face out of little smiley
faces, as shown in Figure 7-7.
Figure 7-7: We’ve made our smiley program more interactive, drawing
wherever the user clicks.