ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

小猪佩奇

2022-05-06 16:32:14  阅读:167  来源: 互联网

标签:10 小猪 画笔 30 设置 100 佩奇 255


  1 # coding:utf-8
  2 import turtle as t
  3 t.pensize(4) # 设置画笔的大小
  4 t.colormode(255) # 设置GBK颜色范围为0-255
  5 t.color((255,155,192),"pink") # 设置画笔颜色和填充颜色(pink)
  6 t.setup(840,500) # 设置主窗口的大小为840*500
  7 t.speed(10) # 设置画笔速度为10
  8 #鼻子
  9 t.pu() # 提笔
 10 t.goto(-100,100) # 画笔前往坐标(-100,100)
 11 t.pd() # 下笔
 12 t.seth(-30) # 笔的角度为-30°
 13 t.begin_fill() # 外形填充的开始标志
 14 a=0.4
 15 for i in range(120):
 16    if 0<=i<30 or 60<=i<90:
 17        a=a+0.08
 18        t.lt(3) #向左转3度
 19        t.fd(a) #向前走a的步长
 20    else:
 21        a=a-0.08
 22        t.lt(3)
 23        t.fd(a)
 24 t.end_fill() # 依据轮廓填充
 25 t.pu() # 提笔
 26 t.seth(90) # 笔的角度为90度
 27 t.fd(25) # 向前移动25
 28 t.seth(0) # 转换画笔的角度为0
 29 t.fd(10)
 30 t.pd()
 31 t.pencolor(255,155,192) # 设置画笔颜色
 32 t.seth(10)
 33 t.begin_fill()
 34 t.circle(5) # 画一个半径为5的圆
 35 t.color(160,82,45) # 设置画笔和填充颜色
 36 t.end_fill()
 37 t.pu()
 38 t.seth(0)
 39 t.fd(20)
 40 t.pd()
 41 t.pencolor(255,155,192)
 42 t.seth(10)
 43 t.begin_fill()
 44 t.circle(5)
 45 t.color(160,82,45)
 46 t.end_fill()
 47 #头
 48 t.color((255,155,192),"pink")
 49 t.pu()
 50 t.seth(90)
 51 t.fd(41)
 52 t.seth(0)
 53 t.fd(0)
 54 t.pd()
 55 t.begin_fill()
 56 t.seth(180)
 57 t.circle(300,-30) # 顺时针画一个半径为300,圆心角为30°的园
 58 t.circle(100,-60)
 59 t.circle(80,-100)
 60 t.circle(150,-20)
 61 t.circle(60,-95)
 62 t.seth(161)
 63 t.circle(-300,15)
 64 t.pu()
 65 t.goto(-100,100)
 66 t.pd()
 67 t.seth(-30)
 68 a=0.4
 69 for i in range(60):
 70    if 0<=i<30 or 60<=i<90:
 71        a=a+0.08
 72        t.lt(3) #向左转3度
 73        t.fd(a) #向前走a的步长
 74    else:
 75        a=a-0.08
 76        t.lt(3)
 77        t.fd(a)
 78 t.end_fill()
 79 #耳朵
 80 t.color((255,155,192),"pink")
 81 t.pu()
 82 t.seth(90)
 83 t.fd(-7)
 84 t.seth(0)
 85 t.fd(70)
 86 t.pd()
 87 t.begin_fill()
 88 t.seth(100)
 89 t.circle(-50,50)
 90 t.circle(-10,120)
 91 t.circle(-50,54)
 92 t.end_fill()
 93 t.pu()
 94 t.seth(90)
 95 t.fd(-12)
 96 t.seth(0)
 97 t.fd(30)
 98 t.pd()
 99 t.begin_fill()
100 t.seth(100)
101 t.circle(-50,50)
102 t.circle(-10,120)
103 t.circle(-50,56)
104 t.end_fill()
105 #眼睛
106 t.color((255,155,192),"white")
107 t.pu()
108 t.seth(90)
109 t.fd(-20)
110 t.seth(0)
111 t.fd(-95)
112 t.pd()
113 t.begin_fill()
114 t.circle(15)
115 t.end_fill()
116 t.color("black")
117 t.pu()
118 t.seth(90)
119 t.fd(12)
120 t.seth(0)
121 t.fd(-3)
122 t.pd()
123 t.begin_fill()
124 t.circle(3)
125 t.end_fill()
126 t.color((255,155,192),"white")
127 t.pu()
128 t.seth(90)
129 t.fd(-25)
130 t.seth(0)
131 t.fd(40)
132 t.pd()
133 t.begin_fill()
134 t.circle(15)
135 t.end_fill()
136 t.color("black")
137 t.pu()
138 t.seth(90)
139 t.fd(12)
140 t.seth(0)
141 t.fd(-3)
142 t.pd()
143 t.begin_fill()
144 t.circle(3)
145 t.end_fill()
146 #腮
147 t.color((255,155,192))
148 t.pu()
149 t.seth(90)
150 t.fd(-95)
151 t.seth(0)
152 t.fd(65)
153 t.pd()
154 t.begin_fill()
155 t.circle(30)
156 t.end_fill()
157 #嘴
158 t.color(239,69,19)
159 t.pu()
160 t.seth(90)
161 t.fd(15)
162 t.seth(0)
163 t.fd(-100)
164 t.pd()
165 t.seth(-80)
166 t.circle(30,40)
167 t.circle(40,80)
168 #身体
169 t.color("red",(255,99,71))
170 t.pu()
171 t.seth(90)
172 t.fd(-20)
173 t.seth(0)
174 t.fd(-78)
175 t.pd()
176 t.begin_fill()
177 t.seth(-130)
178 t.circle(100,10)
179 t.circle(300,30)
180 t.seth(0)
181 t.fd(230)
182 t.seth(90)
183 t.circle(300,30)
184 t.circle(100,3)
185 t.color((255,155,192),(255,100,100))
186 t.seth(-135)
187 t.circle(-80,63)
188 t.circle(-150,24)
189 t.end_fill()
190 #手
191 t.color((255,155,192))
192 t.pu()
193 t.seth(90)
194 t.fd(-40)
195 t.seth(0)
196 t.fd(-27)
197 t.pd()
198 t.seth(-160)
199 t.circle(300,15)
200 t.pu()
201 t.seth(90)
202 t.fd(15)
203 t.seth(0)
204 t.fd(0)
205 t.pd()
206 t.seth(-10)
207 t.circle(-20,90)
208 t.pu()
209 t.seth(90)
210 t.fd(30)
211 t.seth(0)
212 t.fd(237)
213 t.pd()
214 t.seth(-20)
215 t.circle(-300,15)
216 t.pu()
217 t.seth(90)
218 t.fd(20)
219 t.seth(0)
220 t.fd(0)
221 t.pd()
222 t.seth(-170)
223 t.circle(20,90)
224 #脚
225 t.pensize(10)
226 t.color((240,128,128))
227 t.pu()
228 t.seth(90)
229 t.fd(-75)
230 t.seth(0)
231 t.fd(-180)
232 t.pd()
233 t.seth(-90)
234 t.fd(40)
235 t.seth(-180)
236 t.color("black")
237 t.pensize(15)
238 t.fd(20)
239 t.pensize(10)
240 t.color((240,128,128))
241 t.pu()
242 t.seth(90)
243 t.fd(40)
244 t.seth(0)
245 t.fd(90)
246 t.pd()
247 t.seth(-90)
248 t.fd(40)
249 t.seth(-180)
250 t.color("black")
251 t.pensize(15)
252 t.fd(20)
253 #尾巴
254 t.pensize(4)
255 t.color((255,155,192))
256 t.pu()
257 t.seth(90)
258 t.fd(70)
259 t.seth(0)
260 t.fd(95)
261 t.pd()
262 t.seth(0)
263 t.circle(70,20)
264 t.circle(10,330)
265 t.circle(70,30)

 

标签:10,小猪,画笔,30,设置,100,佩奇,255
来源: https://www.cnblogs.com/Cx330--mc/p/16229311.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有