用python画气球程序_运用python绘制小猪佩奇
1. from turtle import *
2.3. def nose(x,y):#鼻子
4. penup()#提起笔
5. goto(x,y)#定位
6. pendown()#落笔,开始画
7. setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东、90-北、180-西、270-南)
8. begin_fill()#准备开始填充图形
9. a=0.4
10. for i in range(120):11. if 0<=i<30 or 60<=i<90:12. a=a+0.08
13. left(3) #向左转3度
14. forward(a) #向前走a的步长
15. else:16. a=a-0.08
17. left(3)18. forward(a)19. end_fill()#填充完成
20.21. penup()22. setheading(90)23. forward(25)24. setheading(0)25. forward(10)26. pendown()27. pencolor(255,155,192)#画笔颜色
28. setheading(10)29. begin_fill()30. circle(5)31. color(160,82,45)#返回或设置pencolor和fillcolor
32. end_fill()33.34. penup()35. setheading(0)36. forward(20)37. pendown()38. pencolor(255,155,192)39. setheading(10)40. begin_fill()41. circle(5)42. color(160,82,45)43. end_fill()44.45.46. def head(x,y):#头
47. color((255,155,192),"pink")48. penup()49. goto(x,y)50. setheading(0)51. pendown()52. begin_fill()53. setheading(180)54. circle(300,-30)55. circle(100,-60)56. circle(80,-100)57. circle(150,-20)58. circle(60,-95)59. setheading(161)60. circle(-300,15)61. penup()62. goto(-100,100)63. pendown()64. setheading(-30)65. a=0.4
66. for i in range(60):67. if 0<=i<30 or 60<=i<90:68. a=a+0.08
69. lt(3) #向左转3度
70. fd(a) #向前走a的步长
71. else:72. a=a-0.08
73. lt(3)74. fd(a)75. end_fill()76.77.78. def ears(x,y): #耳朵
79. color((255,155,192),"pink")80. penup()81. goto(x,y)82. pendown()83. begin_fill()84. setheading(100)85. circle(-50,50)86. circle(-10,120)87. circle(-50,54)88. end_fill()89.90. penup()91. setheading(90)92. forward(-12)93. setheading(0)94. forward(30)95. pendown()96. begin_fill()97. setheading(100)98. circle(-50,50)99. circle(-10,120)100. circle(-50,56)101. end_fill()102.103.104. def eyes(x,y):#眼睛
105. color((255,155,192),"white")106. penup()107. setheading(90)108. forward(-20)109. setheading(0)110. forward(-95)111. pendown()112. begin_fill()113. circle(15)114. end_fill()115.116. color("black")117. penup()118. setheading(90)119. forward(12)120. setheading(0)121. forward(-3)122. pendown()123. begin_fill()124. circle(3)125. end_fill()126.127. color((255,155,192),"white")128. penup()129. seth(90)130. forward(-25)131. seth(0)132. forward(40)133. pendown()134. begin_fill()135. circle(15)136. end_fill()137.138. color("black")139. penup()140. setheading(90)141. forward(12)142. setheading(0)143. forward(-3)144. pendown()145. begin_fill()146. circle(3)147. end_fill()148.149.150. def cheek(x,y):#腮
151. color((255,155,192))152. penup()153. goto(x,y)154. pendown()155. setheading(0)156. begin_fill()157. circle(30)158. end_fill()159.160.161. def mouth(x,y): #嘴
162. color(239,69,19)163. penup()164. goto(x,y)165. pendown()166. setheading(-80)167. circle(30,40)168. circle(40,80)169.170. def body(x,y):#身体
171. color("red",(255,99,71))172. penup()173. goto(x,y)174. pendown()175. begin_fill()176. setheading(-130)177. circle(100,10)178. circle(300,30)179. setheading(0)180. forward(230)181. setheading(90)182. circle(300,30)183. circle(100,3)184. color((255,155,192),(255,100,100))185. setheading(-135)186. circle(-80,63)187. circle(-150,24)188. end_fill()189.190.191. def hands(x,y):#手
192. color((255,155,192))193. penup()194. goto(x,y)195. pendown()196. setheading(-160)197. circle(300,15)198. penup()199. setheading(90)200. forward(15)201. setheading(0)202. forward(0)203. pendown()204. setheading(-10)205. circle(-20,90)206.207. penup()208. setheading(90)209. forward(30)210. setheading(0)211. forward(237)212. pendown()213. setheading(-20)214. circle(-300,15)215. penup()216. setheading(90)217. forward(20)218. setheading(0)219. forward(0)220. pendown()221. setheading(-170)222. circle(20,90)223.224. def foot(x,y):#脚
225. pensize(10)226. color((240,128,128))227. penup()228. goto(x,y)229. pendown()230. setheading(-90)231. forward(40)232. setheading(-180)233. color("black")234. pensize(15)235. fd(20)236.237. pensize(10)238. color((240,128,128))239. penup()240. setheading(90)241. forward(40)242. setheading(0)243. forward(90)244. pendown()245. setheading(-90)246. forward(40)247. setheading(-180)248. color("black")249. pensize(15)250. fd(20)251.252. def tail(x,y):#尾巴
253. pensize(4)254. color((255,155,192))255. penup()256. goto(x,y)257. pendown()258. seth(0)259. circle(70,20)260. circle(10,330)261. circle(70,30)262.263. def setting(): #参数设置
264. pensize(4)265. hideturtle() #使乌龟无形(隐藏)
266. colormode(255) #将其设置为1.0或255.随后 颜色三元组的r,g,b值必须在0 .. cmode范围内
267. color((255,155,192),"pink")268. setup(840,500)269. speed(10)270.271. defmain():272. setting() #画布、画笔设置
273. nose(-100,100) #鼻子
274. head(-69,167) #头
275. ears(0,160) #耳朵
276. eyes(0,140) #眼睛
277. cheek(80,10) #腮
278. mouth(-20,30) #嘴
279. body(-32,-8) #身体
280. hands(-56,-45) #手
281. foot(2,-177) #脚
282. tail(148,-155) #尾巴
283. done()284.285. if __name__ == '__main__':286. main()
用python画气球程序_运用python绘制小猪佩奇相关推荐
- python画棒棒糖程序_用python 画几个简单图案
from random importchoice # random 的choice方法能够在你给出的结果里随机选择一个importmatplotlib.pyplot as plt # 引入matplo ...
- python简单图画程序_用Python的Turtple画图形
不知道各位是否还记得在小学或者初中的时候,我们接触过一种语言叫做logo语言,这个语言可以画正方形,画三角形,画圆.而用Python画图形也有点类似logo语言的意思. 在画图之前,我们需要启动一个模 ...
- python画卡通人物_用python画出一个卡通人物程序应该怎样编写?
我只会小猪佩奇,哈哈哈 # coding:utf-8 import turtle as t t.pensize(4) # 设置画笔的大小 t.colormode(255) # 设置GBK颜色范围为0- ...
- python画交互式地图_使用Python构建交互式地图-入门指南
python画交互式地图 Welcome to The Beginner's Guide to Building Interactive Maps in Python 欢迎使用Python构建交互式地 ...
- 用python画哆啦a梦的身体_每天一个Python小技巧,用Python 画个多啦A梦,小猪佩奇,文末还有Python入门学习视频...
见网络上有人用Python 画出来个多啦A梦,很是新奇,来来来,我们看一下他们主要用到的库. 其实主要用的库就一个 turtle 库 先说明一下turtle绘图的基础知识: 1. 画布(canvas) ...
- python turtle绕原点旋转_每天一个Python小技巧,用Python 画个多啦A梦,小猪佩奇,文末还有Python入门学习视频
见网络上有人用Python 画出来个多啦A梦,很是新奇,来来来,我们看一下他们主要用到的库. 其实主要用的库就一个 turtle 库 先说明一下turtle绘图的基础知识: 1. 画布(canvas) ...
- 用python画动态樱花_利用python画一棵漂亮的樱花树,turtle画图代码大全,此处感谢知乎大佬小白...
利用python画一棵漂亮的樱花树,turtle画图代码大全,此处感谢知乎大佬小白 此处感谢知乎大佬 小白练手 练习一下比较流行的turtle(海龟库) 画一棵漂亮的樱花树,效果如下: ps: 是动态 ...
- python 客户端应用程序_创建python Web服务和C#客户端应用程序的最佳方法 - c#
我正在寻找一种简单可靠的方法来创建Python Web Service并从.Net(c#)应用程序中使用它. 我发现了很多不同的库,其中一个库比另一个库好,但是似乎没有人提供关于Python Web ...
- python写机器人程序_用Python写的一个多线程机器人聊天程序
本人是从事php开发的, 近来想通过php实现即时通讯(兼容windows).后来发现实现起来特别麻烦, 就想到python.听说这家伙在什么地方都能发挥作用.所以想用python来做通讯模块...所 ...
最新文章
- 【新产品发布】【iHMI43 智能液晶模块 2013 版】
- 谷歌地图最新hosts_如何查看2020最新版谷歌地球高精度卫星地图(附下载方法)...
- oralce 角色 权限
- HTML5中各种标签总结(多媒体标签)
- 虎符杯——虚拟机逆向
- linux下安装oracle集群,【Oracle 集群】Linux下Oracle RAC集群搭建之Oracle DataBase安装(八)...
- c++builder启动了怎么停止_App 竟然是这样跑起来的 —— Android App/Activity 启动流程分析...
- [编程题] 按照左右半区的方式重新组合单链表
- mysql安装包脚本之家_CentOS 7 MySQL5.7 TAR包解压 全自动化脚本
- 创建项目提交至GitHub
- 使用商业模式的九大模块去分析京东的商业模式_【荐读】商业模式新生代
- Android8.1展讯平台之audio_policy_configuration.xml(四十二)
- (原创)[短小精悍系列]RGB(RGI/RGV)颜色明度(亮度)计算公式 (又称灰度公式,彩色照片转黑白照片时能派上用场)
- Tab页面知识整理及其方法分析
- Luckysheet导出excel
- LightOJ1066
- css3魔方3乘3每层旋转_CSS3旋转魔方
- 为什么电子邮件发送失败?电子邮件发送失败的原因及解决方法
- JAVA+基于微信小程序的校园信息共享平台 毕业设计-附源码211615
- Java 面试/笔试题神整理 [Java web and android]
热门文章
- Windows下Emacs安装evil插件
- [Linux]_[初级]_[用户相关命令]持续更新*
- 【飞桨PaddlePaddle】四天搞懂生成对抗网络(二)——风格迁移的“精神始祖”Conditional GAN
- 七问Redis,才知道我与技术大牛的差距在哪里
- 猴子吃桃问题c语言两种实现形式:传统方式和通过递归函数的形式实现,简单易懂
- 如何使用IDM不限速下载百度云盘资源
- Linux基本功系列之chown命令实战
- PHP控制反转和依赖注入的理解(通俗易懂)
- 数据挖掘技术在知识型CRM中的应用研究
- ios保存gif到相册_IOS开发入门之iOS GIF图片导入到相册处理方法