-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmiley.py
More file actions
66 lines (45 loc) · 1.38 KB
/
smiley.py
File metadata and controls
66 lines (45 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import turtle # Import the Turtle graphics library
# Create a Turtle object named 't'
t = turtle.Turtle()
# Set the fill color to yellow for filling the shapes
t.fillcolor('yellow')
# Begin filling the shape with the specified color
t.begin_fill()
# Draw a yellow circle with a radius of 100, creating the face of the smiley face
t.circle(100)
# End filling the shape
t.end_fill()
# Pen up to lift the pen from the canvas
t.penup()
# Move the turtle to the position (-40, 120) without drawing
t.goto(-40, 120)
# Pen down to start drawing again
t.pendown()
# Begin filling a circle with a radius of 10, creating the left eye
t.begin_fill()
t.circle(10)
# End filling the left eye
t.end_fill()
# Pen up to lift the pen
t.penup()
# Move the turtle to the position (40, 120) without drawing
t.goto(40, 120)
# Pen down to start drawing
t.pendown()
# Begin filling a circle with a radius of 10, creating the right eye
t.begin_fill()
t.circle(10)
# End filling the right eye
t.end_fill()
# Pen up to lift the pen
t.penup()
# Move the turtle to the position (0, 85) without drawing
t.goto(-30, 85)
# Pen down to start drawing
t.pendown()
# Rotate the turtle 90 degrees to the right
t.right(90)
# Draw a curved line to create the smile using a part of a circle with a radius of 50 and an angle of 85 degrees
t.circle(30, 190)
# Close the Turtle graphics window when you click on it
turtle.done()