File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from turtle import *
2+
3+
4+ # 无轨迹跳跃
5+ def my_goto (x , y ):
6+ penup ()
7+ goto (x , y )
8+ pendown ()
9+
10+ # 眼睛
11+ def eyes ():
12+ fillcolor ("#ffffff" )
13+ begin_fill ()
14+
15+ tracer (False )
16+ a = 2.5
17+ for i in range (120 ):
18+ if 0 <= i < 30 or 60 <= i < 90 :
19+ a -= 0.05
20+ lt (3 )
21+ fd (a )
22+ else :
23+ a += 0.05
24+ lt (3 )
25+ fd (a )
26+ tracer (True )
27+ end_fill ()
28+
29+
30+ # 胡须
31+ def beard ():
32+ my_goto (- 32 , 135 )
33+ seth (165 )
34+ fd (60 )
35+
36+ my_goto (- 32 , 125 )
37+ seth (180 )
38+ fd (60 )
39+
40+ my_goto (- 32 , 115 )
41+ seth (193 )
42+ fd (60 )
43+
44+ my_goto (37 , 135 )
45+ seth (15 )
46+ fd (60 )
47+
48+ my_goto (37 , 125 )
49+ seth (0 )
50+ fd (60 )
51+
52+ my_goto (37 , 115 )
53+ seth (- 13 )
54+ fd (60 )
55+
56+ # 嘴巴
57+ def mouth ():
58+ my_goto (5 , 148 )
59+ seth (270 )
60+ fd (100 )
61+ seth (0 )
62+ circle (120 , 50 )
63+ seth (230 )
64+ circle (- 120 , 100 )
65+
66+ # 围巾
67+ def scarf ():
68+ fillcolor ('#e70010' )
69+ begin_fill ()
70+ seth (0 )
71+ fd (200 )
72+ circle (- 5 , 90 )
73+ fd (10 )
74+ circle (- 5 , 90 )
75+ fd (207 )
76+ circle (- 5 , 90 )
77+ fd (10 )
78+ circle (- 5 , 90 )
79+ end_fill ()
80+
81+ # 鼻子
82+ def nose ():
83+ my_goto (- 10 , 158 )
84+ seth (315 )
85+ fillcolor ('#e70010' )
86+ begin_fill ()
87+ circle (20 )
88+ end_fill ()
89+
90+ # 黑眼睛
91+ def black_eyes ():
92+ seth (0 )
93+ my_goto (- 20 , 195 )
94+ fillcolor ('#000000' )
95+ begin_fill ()
96+ circle (13 )
97+ end_fill ()
98+
99+ pensize (6 )
100+ my_goto (20 , 205 )
101+ seth (75 )
102+ circle (- 10 , 150 )
103+ pensize (3 )
104+
105+ my_goto (- 17 , 200 )
106+ seth (0 )
107+ fillcolor ('#ffffff' )
108+ begin_fill ()
109+ circle (5 )
110+ end_fill ()
111+ my_goto (0 , 0 )
112+
113+
114+
115+ # 脸
116+ def face ():
117+
118+ fd (183 )
119+ lt (45 )
120+ fillcolor ('#ffffff' )
121+ begin_fill ()
122+ circle (120 , 100 )
123+ seth (180 )
124+ # print(pos())
125+ fd (121 )
126+ pendown ()
127+ seth (215 )
128+ circle (120 , 100 )
129+ end_fill ()
130+ my_goto (63.56 ,218.24 )
131+ seth (90 )
132+ eyes ()
133+ seth (180 )
134+ penup ()
135+ fd (60 )
136+ pendown ()
137+ seth (90 )
138+ eyes ()
139+ penup ()
140+ seth (180 )
141+ fd (64 )
142+
143+ # 头型
144+ def head ():
145+ penup ()
146+ circle (150 , 40 )
147+ pendown ()
148+ fillcolor ('#00a0de' )
149+ begin_fill ()
150+ circle (150 , 280 )
151+ end_fill ()
152+
153+ # 画哆啦A梦
154+ def Doraemon ():
155+ # 头部
156+ head ()
157+
158+ # 围脖
159+ scarf ()
160+
161+ # 脸
162+ face ()
163+
164+ # 红鼻子
165+ nose ()
166+
167+ # 嘴巴
168+ mouth ()
169+
170+ # 胡须
171+ beard ()
172+
173+ # 身体
174+ my_goto (0 , 0 )
175+ seth (0 )
176+ penup ()
177+ circle (150 , 50 )
178+ pendown ()
179+ seth (30 )
180+ fd (40 )
181+ seth (70 )
182+ circle (- 30 , 270 )
183+
184+
185+ fillcolor ('#00a0de' )
186+ begin_fill ()
187+
188+ seth (230 )
189+ fd (80 )
190+ seth (90 )
191+ circle (1000 , 1 )
192+ seth (- 89 )
193+ circle (- 1000 , 10 )
194+
195+ # print(pos())
196+
197+ seth (180 )
198+ fd (70 )
199+ seth (90 )
200+ circle (30 , 180 )
201+ seth (180 )
202+ fd (70 )
203+
204+ # print(pos())
205+ seth (100 )
206+ circle (- 1000 , 9 )
207+
208+ seth (- 86 )
209+ circle (1000 , 2 )
210+ seth (230 )
211+ fd (40 )
212+
213+ # print(pos())
214+
215+
216+ circle (- 30 , 230 )
217+ seth (45 )
218+ fd (81 )
219+ seth (0 )
220+ fd (203 )
221+ circle (5 , 90 )
222+ fd (10 )
223+ circle (5 , 90 )
224+ fd (7 )
225+ seth (40 )
226+ circle (150 , 10 )
227+ seth (30 )
228+ fd (40 )
229+ end_fill ()
230+
231+ # 左手
232+ seth (70 )
233+ fillcolor ('#ffffff' )
234+ begin_fill ()
235+ circle (- 30 )
236+ end_fill ()
237+
238+ # 脚
239+ my_goto (103.74 , - 182.59 )
240+ seth (0 )
241+ fillcolor ('#ffffff' )
242+ begin_fill ()
243+ fd (15 )
244+ circle (- 15 , 180 )
245+ fd (90 )
246+ circle (- 15 , 180 )
247+ fd (10 )
248+ end_fill ()
249+
250+ my_goto (- 96.26 , - 182.59 )
251+ seth (180 )
252+ fillcolor ('#ffffff' )
253+ begin_fill ()
254+ fd (15 )
255+ circle (15 , 180 )
256+ fd (90 )
257+ circle (15 , 180 )
258+ fd (10 )
259+ end_fill ()
260+
261+ # 右手
262+ my_goto (- 133.97 , - 91.81 )
263+ seth (50 )
264+ fillcolor ('#ffffff' )
265+ begin_fill ()
266+ circle (30 )
267+ end_fill ()
268+
269+ # 口袋
270+ my_goto (- 103.42 , 15.09 )
271+ seth (0 )
272+ fd (38 )
273+ seth (230 )
274+ begin_fill ()
275+ circle (90 , 260 )
276+ end_fill ()
277+
278+ my_goto (5 , - 40 )
279+ seth (0 )
280+ fd (70 )
281+ seth (- 90 )
282+ circle (- 70 , 180 )
283+ seth (0 )
284+ fd (70 )
285+
286+ #铃铛
287+ my_goto (- 103.42 , 15.09 )
288+ fd (90 )
289+ seth (70 )
290+ fillcolor ('#ffd200' )
291+ # print(pos())
292+ begin_fill ()
293+ circle (- 20 )
294+ end_fill ()
295+ seth (170 )
296+ fillcolor ('#ffd200' )
297+ begin_fill ()
298+ circle (- 2 , 180 )
299+ seth (10 )
300+ circle (- 100 , 22 )
301+ circle (- 2 , 180 )
302+ seth (180 - 10 )
303+ circle (100 , 22 )
304+ end_fill ()
305+ goto (- 13.42 , 15.09 )
306+ seth (250 )
307+ circle (20 , 110 )
308+ seth (90 )
309+ fd (15 )
310+ dot (10 )
311+ my_goto (0 , - 150 )
312+
313+ # 画眼睛
314+ black_eyes ()
315+
316+ if __name__ == '__main__' :
317+ screensize (800 ,600 , "#f0f0f0" )
318+ pensize (3 ) # 画笔宽度
319+ speed (9 ) # 画笔速度
320+ Doraemon ()
321+ my_goto (100 , - 300 )
322+ write ('by 今晚打老虎' , font = ("Bradley Hand ITC" , 30 , "bold" ))
323+ mainloop ()
You can’t perform that action at this time.
0 commit comments