python海龟画哆啦a梦_python 海龟绘图画哆啦A梦
import turtle as t
#定位
def my_goto(x,y):
t.up()
t.goto(x,y)
t.down()
#眼睛
def eyes():
t.tracer(False)
a = 2.5
for i in range(120):
if 0
a -= 0.05
t.lt(3)
t.fd(a)
else:
a += 0.05
t.lt(3)
t.fd(a)
t.tracer(True)
#胡须
def beard(x,y,s,f):
my_goto(x, y)
t.seth(s)
t.fd(f)
#画手
def hand(s,color,c):
t.seth(s)
t.fillcolor(color)
t.begin_fill()
t.circle(c)
t.end_fill()
#画脚
def foot(x,y,s,color,f1,c1,c2,f2,c3,c4,f4):
my_goto(x, y)
t.seth(s)
t.fillcolor(color)
t.begin_fill()
t.fd(f1)
t.circle(c1, c2)
t.fd(f2)
t.circle(c3, c4)
t.fd(f4)
t.end_fill()
#头
t.pensize(3)
t.up()
t.circle(150,40)
t.down()
t.fillcolor("#007fff")
t.begin_fill()
t.circle(150,280)
t.end_fill()
#围巾
t.fillcolor("#ff7f00")
t.begin_fill()
t.seth(0)#绝对角度
t.fd(200)#前进200
t.circle(-5,90)
t.fd(10)
t.circle(-5,90)
t.fd(207)
t.circle(-5,90)
t.fd(10)
t.circle(-5,90)
t.end_fill()
#脸
t.fd(183)
t.fillcolor('#ffffff')
t.begin_fill()
t.lt(45)
t.circle(120, 100)
t.seth(90)
eyes()
t.seth(180)
t.up()
t.fd(60)
t.down()
t.seth(90)
eyes()
t.up()
t.seth(180)
t.fd(64)
t.down()
t.seth(215)
t.circle(120, 100)
t.end_fill()
#鼻子
my_goto(-10,158)
t.fillcolor("#ffcc00")
t.begin_fill()
t.circle(20)
t.end_fill()
#嘴巴
my_goto(5,148)
t.seth(270)
t.fd(100)
t.seth(0)
t.circle(120,50)
t.seth(230)
t.circle(-120,100)
# 画胡须
beard(-37,135,165,60)
beard(-37,125,180,60)
beard(-37,115,193,60)
beard(37,135,15,60)
beard(37,125,0,60)
beard(37,115,-13,60)
#画身体
my_goto(0, 0)
t.seth(0)
t.up()
t.circle(150, 50)
t.down()
t.seth(30)
t.fd(40)
t.seth(70)
t.circle(-30, 270)
t.fillcolor('#00a0de')
t.begin_fill()
t.seth(230)
t.fd(80)
t.seth(90)
t.circle(1000, 1)
t.seth(-89)
t.circle(-1000, 10)
t.seth(180)
t.fd(70)
t.seth(90)
t.circle(30, 180)
t.seth(180)
t.fd(70)
t.seth(100)
t.circle(-1000, 9)
t.seth(-86)
t.circle(1000, 2)
t.seth(230)
t.fd(40)
t.circle(-30, 230)
t.seth(45)
t.fd(81)
t.seth(0)
t.fd(203)
t.circle(5, 90)
t.fd(10)
t.circle(5, 90)
t.fd(7)
t.seth(40)
t.circle(150, 10)
t.seth(30)
t.fd(40)
t.end_fill()
# 左手
hand(70,'#ffffff',-30)
# 右手
my_goto(-133.97, -91.81)
hand(50,'#ffffff',30)
# 脚
foot(103.74,-182.59,0,'#ffffff',15,-15,180,90,-15,180,10)
foot(-96.26,-182.59,180,'#ffffff',15,15,180,90,15,180,10)
# 口袋
my_goto(-103.42, 15.09)
t.seth(0)
t.fd(38)
t.seth(230)
t.begin_fill()
t.circle(90, 260)
t.end_fill()
my_goto(5, -40)
t.seth(0)
t.fd(70)
t.seth(-90)
t.circle(-70, 180)
t.seth(0)
t.fd(70)
#铃铛
my_goto(-103.42, 15.09)
t.fd(90)
t.seth(70)
t.fillcolor('#ffd200')
t.begin_fill()
t.circle(-20)
t.end_fill()
t.seth(170)
t.fillcolor('#ffd200')
t.begin_fill()
t.circle(-2, 180)
t.seth(10)
t.circle(-100, 22)
t.circle(-2, 180)
t.seth(180-10)
t.circle(100, 22)
t.end_fill()
t.goto(-13.42, 15.09)
t.seth(250)
t.circle(20, 110)
t.seth(90)
t.fd(15)
t.dot(10)#dot绘制一个指定直径和颜色的圆点.
my_goto(0, -150)
# 眼睛
t.seth(0)
my_goto(-20, 195)
t.fillcolor('#000000')
t.begin_fill()
t.circle(13)
t.end_fill()
t.pensize(6)
my_goto(20, 205)
t.seth(75)
t.circle(-10, 150)
t.pensize(3)
my_goto(-17, 200)
t.seth(0)
t.fillcolor('#ffffff')
t.begin_fill()
t.circle(5)
t.end_fill()
my_goto(0, 0)
t.exitonclick()#不关闭窗体
python海龟画哆啦a梦_python 海龟绘图画哆啦A梦相关推荐
- python画圆及其内接多边形_Python turtle 绘图画圆(2)
turtle.circle(radius, extent=None, steps=None) 描述: 以给定半径画圆 参数: radius(半径); 半径为正(负),表示圆心在画笔的左边(右边)画圆 ...
- 用python函数画德国国旗代码_python海龟绘图之画国旗实例代码
画之前肯定要知道规格图,我找了一个大致的图. 参考图片: 绘制大星的方法很简单,五角星的补角是144度. 绘制小五角星有点麻烦,因为我国国旗上的小五角星并不是平放的(美帝曾经这样把我们的国旗搞错过), ...
- python用海龟画圆的代码_Python海龟绘图——常用方法指令
海龟绘图很适合用来引导孩子学习编程,通过编写简短的.简单的程序来创建漂亮的.复杂的视觉效果.而且还可以通过跟随海龟观察到每行代码是如何影响到它的移动,可以很好的帮助我们理解代码的逻辑,也是非常适合孩子 ...
- python turtle画画 30排以内_Python竟能画这么漂亮的花,帅呆了(代码分享)
阅读本文大概需要3分钟 关于函数和模块讲了这么久,我一直想用一个好玩有趣的小例子来总结一下,同时也作为实战练习一下. 趣味编程其实是最好的学习途径,回想十几年前我刚毕业的时候,第一份工作就给手机上写a ...
- python画多个圆_python turtle库画一个方格和圆实例
python turtle库画一个方格和圆实例 使用python的turtle库画一个方格和圆 打开python编译器,导入turtle库 from turtle import * 首先画一个距离为1 ...
- python turtle画房子详细解释_Python Turtle 绘图
Turtle 绘图 海龟绘图 (Turtle Graphics),原本是发明给儿童学习编程的.现在也移植到许多高级语音中,Python 也内置了 turtle 库,基本上能够复原 Turtle Gra ...
- 用python画爱心写一句话_python中用turtle画爱心表白
python中用turtle画爱心表白python 运行后的效果图:ide 下面的代码是在python3.7写的,代码有点长,但却语法简单易懂动画 代码以下:orm import turtle str ...
- python画长方形的代码_python使用turtle画一个三角形、正方形(矩形或四边形)
今天我们用python使用turtle库画一个三角形.一个正方形. 1.画一个三角形. 实现方法是先画一个直线,然后旋转120度,然后继续画直线.这样反复画三条直线后,就形成一个等边三角形.先看效果: ...
- python做房源饼状图_python使用matplotlib画饼状图
%matplotlib inlineimport matplotlib.pyplot as plt# 121 > 1行2列第1个fig1 = plt.subplot(121)plt.pie([1 ...
最新文章
- OpenGL函数库详解
- cmos存储器中存放了_CMOS存储器中存放了计算机的一些参数和信息,其中不包含在内的是( )。_学小易找答案...
- centos7下引导win7
- 本博客停止更新,后续用博客园。
- Android 移动开发知识体系
- python中正则表达式的用法_详解Python中的正则表达式的用法
- 前端学习笔记系列一:2 Vue的单文件组件
- 王者荣耀是怎样炼成的(三)unity组件与脚本
- svn server服务器搭建
- ac3165无线网卡驱动linux,intel ac 3165无线网卡驱动下载v20.110.0 官方版
- oracle年龄计算函数天 月 年,如何使用Oracle获得年龄,月份和天数的年龄
- 清理打印机连接数bat_通过批处理bat解决局域网打印机共享问题
- 基于MATLAB的激光光斑图像处理算法
- 使用scrapy爬取前程无忧51job网站
- docker 测试mysql_Mac上使用Docker快速启动MySQL测试
- 美股投资指南 – 网上美股开户其实很简单
- 大都会高端酒店推出迪拜目前最昂贵的豪华顶楼
- android图片裁剪xof,HttpServletResponse response相关头信息,内容信息设置
- IT从业者的职业规划
- 深度学习项目开发流程