python turtle 绘图小猪佩奇_Python turtle画小猪佩奇
import turtle as t
def DrawPeiqi():
t.pensize(4)
t.hideturtle()
t.colormode(255)
t.color((255,155,192),"pink")
t.setup(840,500)
t.speed(10)
#鼻子
t.pu()
t.goto(-100,100)
t.pd()
t.seth(-30)
t.begin_fill()
a=0.4
for i in range(120):
if 0<=i<30 or 60<=i<90:
a=a+0.08
t.lt(3) #向左转3度
t.fd(a) #向前走a的步长
else:
a=a-0.08
t.lt(3)
t.fd(a)
t.end_fill()
t.pu()
t.seth(90)
t.fd(25)
t.seth(0)
t.fd(10)
t.pd()
t.pencolor(255,155,192)
t.seth(10)
t.begin_fill()
t.circle(5)
t.color(160,82,45)
t.end_fill()
t.pu()
t.seth(0)
t.fd(20)
t.pd()
t.pencolor(255,155,192)
t.seth(10)
t.begin_fill()
t.circle(5)
t.color(160,82,45)
t.end_fill()
#头
t.color((255,155,192),"pink")
t.pu()
t.seth(90)
t.fd(41)
t.seth(0)
t.fd(0)
t.pd()
t.begin_fill()
t.seth(180)
t.circle(300,-30)
t.circle(100,-60)
t.circle(80,-100)
t.circle(150,-20)
t.circle(60,-95)
t.seth(161)
t.circle(-300,15)
t.pu()
t.goto(-100,100)
t.pd()
t.seth(-30)
a=0.4
for i in range(60):
if 0<=i<30 or 60<=i<90:
a=a+0.08
t.lt(3) #向左转3度
t.fd(a) #向前走a的步长
else:
a=a-0.08
t.lt(3)
t.fd(a)
t.end_fill()
#耳朵
t.color((255,155,192),"pink")
t.pu()
t.seth(90)
t.fd(-7)
t.seth(0)
t.fd(70)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50,50)
t.circle(-10,120)
t.circle(-50,54)
t.end_fill()
t.pu()
t.seth(90)
t.fd(-12)
t.seth(0)
t.fd(30)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50,50)
t.circle(-10,120)
t.circle(-50,56)
t.end_fill()
#眼睛
t.color((255,155,192),"white")
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-95)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()
t.color((255,155,192),"white")
t.pu()
t.seth(90)
t.fd(-25)
t.seth(0)
t.fd(40)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()
#腮
t.color((255,155,192))
t.pu()
t.seth(90)
t.fd(-95)
t.seth(0)
t.fd(65)
t.pd()
t.begin_fill()
t.circle(30)
t.end_fill()
#嘴
t.color(239,69,19)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(-100)
t.pd()
t.seth(-80)
t.circle(30,40)
t.circle(40,80)
#身体
t.color("red",(255,99,71))
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-78)
t.pd()
t.begin_fill()
t.seth(-130)
t.circle(100,10)
t.circle(300,30)
t.seth(0)
t.fd(230)
t.seth(90)
t.circle(300,30)
t.circle(100,3)
t.color((255,155,192),(255,100,100))
t.seth(-135)
t.circle(-80,63)
t.circle(-150,24)
t.end_fill()
#手
t.color((255,155,192))
t.pu()
t.seth(90)
t.fd(-40)
t.seth(0)
t.fd(-27)
t.pd()
t.seth(-160)
t.circle(300,15)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-10)
t.circle(-20,90)
t.pu()
t.seth(90)
t.fd(30)
t.seth(0)
t.fd(237)
t.pd()
t.seth(-20)
t.circle(-300,15)
t.pu()
t.seth(90)
t.fd(20)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-170)
t.circle(20,90)
#脚
t.pensize(10)
t.color((240,128,128))
t.pu()
t.seth(90)
t.fd(-75)
t.seth(0)
t.fd(-180)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)
t.pensize(10)
t.color((240,128,128))
t.pu()
t.seth(90)
t.fd(40)
t.seth(0)
t.fd(90)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)
#尾巴
t.pensize(4)
t.color((255,155,192))
t.pu()
t.seth(90)
t.fd(70)
t.seth(0)
t.fd(95)
t.pd()
t.seth(0)
t.circle(70,20)
t.circle(10,330)
t.circle(70,30)
python turtle 绘图小猪佩奇_Python turtle画小猪佩奇相关推荐
- python turtle 绘图表情包_Python|turtle|画表情包
今天依然来熟悉一下python中的turtle模块,在这之前我们来看一条段子,也是我无意间get到的,胆小者勿看,因为太wu了.段子是:嫦娥的兔子生病了,于是嫦娥把兔子抱到月老那里.月老看了看兔子说: ...
- python turtle怎么用变量_Python Turtle绘图指定变量时出现问题
几小时后我有一个作业要交,我不知道该做什么. 我使用的是python3.在 我一直试着运行代码,但是我出错了.在这一点上,我想我应该寻求帮助.在 提前谢谢你!在import turtle import ...
- python用turtle调整文字位置_Python turtle学习笔记
一.简介 Turtle最早来自于LOGO语言,是专门用于小孩子学习编程的,通过编程模拟一只turtle(海龟)在画板上爬行绘制图案,后来很多高级语言都移植了海龟绘图,python从2.6之后也将tur ...
- python中的turtle库中引用_python turtle库学习笔记
1.turtle库是python语言中一个很流行的绘制图像的函数库 想象一只小乌龟,在一个横轴为x,纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它 ...
- python turtle库的使用_Python turtle库使用教程
1.基础概念 1 画布(canvas) 画布就是turtle为我们展开用于绘图区域, 我们可以设置它的大小和初始位置. 常用的画布方法有两个:screensize()和setup(). (1)turt ...
- python中mainloop什么意思_Python Turtle mainloop()用法
我有一个online tutorial的以下代码来学习基于事件的编程,方法是在点击鼠标时使停止灯改变状态.这里是我的代码的全部:Python Turtle mainloop()用法 import tu ...
- python里turtle.circle什么意思_Python turtle.circle方法代碼示例
本文整理匯總了Python中turtle.circle方法的典型用法代碼示例.如果您正苦於以下問題:Python turtle.circle方法的具體用法?Python turtle.circle怎麽 ...
- python中的画笔控制函数_Python turtle库的画笔控制说明
turtle.penup() 别名 turtle.pu() :抬起画笔海龟在飞行 turtle.pendown() 别名 turtle.pd():画笔落下,海龟在爬行 turtle.pensize(w ...
- python画小猪乔治_Python turtle 学习笔记
importturtle as t'''t.pu() 提起画笔 t.pd() 移动时绘制图形,缺省时也为绘制 t.seth 设置当前朝向为angle角度 t.begin_fill() 准备开始填充图形 ...
最新文章
- CentOS7用yum安装软件报:Cannot find a valid baseurl for repo: base/7/x86_64
- RocketMQ的原理与实践
- 【剑指offer-Java版】08旋转数组的最小数字
- python系统关键字_python基础之常用关键字总结
- Nacos注册中心介绍
- 【Python】忘记登录密码?遍历数字字母组合密码+模拟提交表单
- MongoDB学习笔记(一)环境搭建与常用操作
- Application page and Site page
- SQLite语句总结
- 水体专题图和土地利用专题图制作
- cmd长ping记录日志和时间_ping命令结果中如何显示时间
- 2005年度世界500强公司名单[转]
- Oracle全局索引和本地索引
- 【Paper-Attack】Graph Universal Adversarial Attacks: A Few Bad Actors Ruin Graph Learning Models
- BERT模型--transflow转为pytorch
- 七段数码管共阳(阴)极常用字形码
- 机械臂6D姿态检测(RGB、RGBD、雷达)综述
- 关于ExecuteNonQuery() 方法
- 关于VERIFY_OCTAL_PERMISSIONS权限检查
- 微信公众号推广技巧之一