-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCodeRunnerFile.python
More file actions
104 lines (91 loc) · 1.95 KB
/
tempCodeRunnerFile.python
File metadata and controls
104 lines (91 loc) · 1.95 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import turtle
screen = turtle.Screen()
screen.bgcolor("white")
pen = turtle.Turtle()
pen.pensize(3)
pen.speed(10)
# Helper function to draw a circle
def draw_circle(color, radius, x, y):
pen.penup()
pen.goto(x, y)
pen.pendown()
pen.fillcolor(color)
pen.begin_fill()
pen.circle(radius)
pen.end_fill()
# Draw face outline
def draw_head():
pen.penup()
pen.goto(0, -200)
pen.pendown()
pen.color("blue")
pen.begin_fill()
pen.circle(200)
pen.end_fill()
# Draw face (white part)
def draw_face():
draw_circle("white", 150, 0, -170)
# Draw eyes
def draw_eyes():
for x in [-35, 35]:
draw_circle("white", 30, x, 20)
draw_circle("black", 10, x, 60)
# Draw nose
def draw_nose():
draw_circle("red", 15, 0, 35)
# Draw mouth
def draw_mouth():
pen.penup()
pen.goto(-50, -40)
pen.setheading(-60)
pen.pendown()
pen.color("black")
pen.circle(100, 120)
# Draw whiskers
def draw_whiskers():
pen.color("black")
whisker_y = [10, 0, -10]
for y in whisker_y:
for x_sign in [-1, 1]:
pen.penup()
pen.goto(x_sign * 20, y)
pen.setheading(0 if x_sign == 1 else 180)
pen.pendown()
pen.forward(60)
# Draw collar
def draw_collar():
draw_circle("red", 10, 0, -160)
pen.penup()
pen.goto(-70, -135)
pen.setheading(0)
pen.pendown()
pen.color("red")
pen.pensize(20)
pen.forward(140)
pen.pensize(3)
# Draw bell
def draw_bell():
draw_circle("yellow", 20, 0, -170)
pen.penup()
pen.goto(0, -190)
pen.setheading(90)
pen.pendown()
pen.color("black")
pen.circle(10, 180)
pen.penup()
pen.goto(-5, -190)
pen.pendown()
pen.forward(10)
# Draw the full Doraemon
def draw_doraemon():
draw_head()
draw_face()
draw_eyes()
draw_nose()
draw_mouth()
draw_whiskers()
draw_collar()
draw_bell()
draw_doraemon()
pen.hideturtle()
turtle.done()