20°

用python的turtle库画哆啦A梦大头贴

20181801058,褚志远

20180301121,周晨

思路来源:1.当初搜过能用turtle画什么,其中有哆啦A梦

2.可爱,不算太复杂,适合菜鸟(like me)

突然发现画多拉阿梦的还不少,浏览了一下,感觉我们的还算是比较可爱的。

源代码:

  1 from turtle import *
  2 speed(10)
  3 pensize(3)
  4 hideturtle()
  5 screensize(500,500,bg='white')
  6 #猫脸
  7 fillcolor('#048db1')#头的颜色
  8 begin_fill()
  9 circle(150)
 10 end_fill()
 11 pensize(2)
 12 fillcolor('#eff1e3')#脸的颜色
 13 begin_fill()
 14 circle(130)
 15 end_fill()
 16 #围巾
 17 pu()
 18 goto(-70,12)
 19 pensize(14)
 20 color('#c43d44')
 21 pd()
 22 seth(-20)
 23 circle(200,30)
 24 circle(200,10)
 25 #铃铛
 26 pu()
 27 goto(0,-46)
 28 pd()
 29 pensize(1)
 30 color("black",'#ffdf4e')
 31 begin_fill()
 32 circle(25)
 33 end_fill()
 34 pu()
 35 goto(-5,-40)
 36 pd()
 37 pensize(1)
 38 color("black",'#79675d')
 39 begin_fill()
 40 circle(5)
 41 end_fill()
 42 pensize(1)
 43 right(115)
 44 forward(7)
 45 #眼睛
 46 pu()
 47 goto(0,250)
 48 pd()
 49 pensize(2)
 50 color('black','white')
 51 begin_fill()
 52 for i in range(30):
 53     forward(7.5)
 54     right(12)
 55 end_fill()
 56 pd()
 57 pensize(2)
 58 color('black','white')
 59 begin_fill()
 60 for i in range(30):
 61     forward(7.5)
 62     left(12)
 63 end_fill()
 64 pu()
 65 goto(-15,250)
 66 pd()
 67 pensize(12)
 68 color('black')
 69 for i in range(30):
 70     forward(2)
 71     right(12)
 72 pu()
 73 goto(15,250)
 74 pd()
 75 pensize(12)
 76 color('black')
 77 for i in range(30):
 78     forward(2)
 79     left(12)
 80 #鼻子
 81 pu()
 82 goto(-25,210) 
 83 pd()
 84 pensize(2)
 85 color('black','red')
 86 begin_fill()
 87 circle(20)
 88 end_fill()
 89 pu()
 90 goto(1,215) 
 91 pd()
 92 pensize(10)
 93 color('white','white')
 94 begin_fill()
 95 circle(0.6)
 96 end_fill()
 97 pu()
 98 pensize(2)
 99 color('black')
100 goto(-4,187)
101 pd()
102 for k in range(-100,-80):
103     k += 0.5
104     fd(6)
105     seth(k)
106 pu()
107 #
108 goto(-35,50)
109 pd()
110 pensize(1)
111 color('black','red')
112 begin_fill() 
113 circle(30) 
114 end_fill()
115 pu()
116 goto(15,65)
117 pd()
118 color('black')
119 pensize(16.3)
120 for k in range(-230,-80):
121       k -= 0.6
122       fd(0.4)
123       seth(k)
124 seth(23)
125 fd(40)
126 pu()
127 goto(18,55)
128 pd()
129 color('red')
130 pensize(12)
131 for k in range(-190,-120):
132       k -= 0.8
133       fd(0.7)
134       seth(k)
135 #腮红
136 pu()
137 goto(-100,200)
138 pd()
139 pensize(1)
140 color('#eff1e3','pink')
141 begin_fill()
142 circle(20)
143 end_fill()
144 pu()
145 goto(65,200)
146 pd()
147 pensize(1)
148 color('#eff1e3','pink')
149 begin_fill()
150 circle(20)
151 end_fill()
152 #胡须
153 pu()
154 goto(-35,170)
155 pd()
156 pensize(1)
157 color('black')
158 seth(160)
159 fd(70)
160 pu()
161 goto(-40,150)
162 pd()
163 pensize(1)
164 color('black')
165 seth(180)
166 fd(75)
167 pu()
168 goto(-35,130)
169 pd()
170 pensize(1)
171 color('black')
172 seth(200)
173 fd(75)
174 pu()
175 goto(35,170)
176 pd()
177 pensize(1)
178 color('black')
179 seth(20)
180 fd(70)
181 pu()
182 goto(40,145)
183 pd()
184 pensize(1)
185 color('black')
186 seth(5)
187 fd(75)
188 pu()
189 goto(45,120)
190 pd()
191 pensize(1)
192 color('black')
193 seth(-15)
194 fd(75)
195 done()

视频:https://www.bilibili.com/video/av52540263/

 

原文链接:https://www.cnblogs.com/yesewangzhe/p/10872581.html

全部评论: 0

    我有话说: