源码:

import turtledef drawNose():turtle.pu()turtle.goto(-100, 100)turtle.pd()turtle.seth(-30)turtle.begin_fill()a=0.4for i in range(120):if 0<=i<30 or 60<=i<90:a=a+0.08turtle.lt(3)turtle.fd(a)else:a=a-0.08turtle.lt(3)turtle.fd(a)turtle.end_fill()turtle.pu()turtle.seth(90)turtle.fd(25)turtle.seth(0)turtle.fd(10)turtle.pd()turtle.pencolor(255, 155, 192)turtle.seth(10)turtle.begin_fill()turtle.circle(5)turtle.color(160, 82, 45)turtle.end_fill()turtle.pu()turtle.seth(0)turtle.fd(20)turtle.pd()turtle.pencolor(255, 155, 192)turtle.seth(10)turtle.begin_fill()turtle.circle(5)turtle.color(160, 82, 45)turtle.end_fill()def drawHead():turtle.color((255, 155, 192), "pink")turtle.pu()turtle.seth(90)turtle.fd(41)turtle.seth(0)turtle.fd(0)turtle.pd()turtle.begin_fill()turtle.seth(180)turtle.circle(300, -30)turtle.circle(100, -60)turtle.circle(80, -100)turtle.circle(150, -20)turtle.circle(60, -95)turtle.seth(161)turtle.circle(-300, 15)turtle.pu()turtle.goto(-100, 100)turtle.pd()turtle.seth(-30)a=0.4for i in range(60):if 0<=i<30 or 60<=i<90:a=a+0.08turtle.lt(3)turtle.fd(a)else:a=a-0.08turtle.lt(3)turtle.fd(a)turtle.end_fill()def drawEar():turtle.color((255, 155, 192), "pink")turtle.pu()turtle.seth(90)turtle.fd(-7)turtle.seth(0)turtle.fd(70)turtle.pd()turtle.begin_fill()turtle.seth(100)turtle.circle(-50, 50)turtle.circle(-10, 120)turtle.circle(-50, 54)turtle.end_fill()turtle.pu()turtle.seth(90)turtle.fd(-12)turtle.seth(0)turtle.fd(30)turtle.pd()turtle.begin_fill()turtle.seth(100)turtle.circle(-50, 50)turtle.circle(-10, 120)turtle.circle(-50, 56)turtle.end_fill()def drawEyes():turtle.color((255, 155, 192), "white")turtle.pu()turtle.seth(90)turtle.fd(-20)turtle.seth(0)turtle.fd(-95)turtle.pd()turtle.begin_fill()turtle.circle(15)turtle.end_fill()turtle.color("black")turtle.pu()turtle.seth(90)turtle.fd(12)turtle.seth(0)turtle.fd(-3)turtle.pd()turtle.begin_fill()turtle.circle(3)turtle.end_fill()turtle.color((255, 155, 192), "white")turtle.pu()turtle.seth(90)turtle.fd(-25)turtle.seth(0)turtle.fd(40)turtle.pd()turtle.begin_fill()turtle.circle(15)turtle.end_fill()turtle.color("black")turtle.pu()turtle.seth(90)turtle.fd(12)turtle.seth(0)turtle.fd(-3)turtle.pd()turtle.begin_fill()turtle.circle(3)turtle.end_fill()def drawBlush():turtle.color((255, 155, 192))turtle.pu()turtle.seth(90)turtle.fd(-95)turtle.seth(0)turtle.fd(65)turtle.pd()turtle.begin_fill()turtle.circle(30)turtle.end_fill()def drawLip():turtle.color(239, 69, 19)turtle.pu()turtle.seth(90)turtle.fd(15)turtle.seth(0)turtle.fd(-100)turtle.pd()turtle.seth(-80)turtle.circle(30, 40)turtle.circle(40, 80)def drawBody():turtle.color("red", (255, 99, 71))turtle.pu()turtle.seth(90)turtle.fd(-20)turtle.seth(0)turtle.fd(-78)turtle.pd()turtle.begin_fill()turtle.seth(-130)turtle.circle(100, 10)turtle.circle(300, 30)turtle.seth(0)turtle.fd(230)turtle.seth(90)turtle.circle(300, 30)turtle.circle(100, 3)turtle.color((255, 155, 192), (255, 100, 100))turtle.seth(-135)turtle.circle(-80, 63)turtle.circle(-150, 24)turtle.end_fill()def drawHand():turtle.color((255, 155, 192))turtle.pu()turtle.seth(90)turtle.fd(-40)turtle.seth(0)turtle.fd(-27)turtle.pd()turtle.seth(-160)turtle.circle(300, 15)turtle.pu()turtle.seth(90)turtle.fd(15)turtle.seth(0)turtle.fd(0)turtle.pd()turtle.seth(-10)turtle.circle(-20, 90)turtle.pu()turtle.seth(90)turtle.fd(30)turtle.seth(0)turtle.fd(237)turtle.pd()turtle.seth(-20)turtle.circle(-300, 15)turtle.pu()turtle.seth(90)turtle.fd(20)turtle.seth(0)turtle.fd(0)turtle.pd()turtle.seth(-170)turtle.circle(20, 90)def drawFoot():turtle.pensize(10)turtle.color((240, 128, 128))turtle.pu()turtle.seth(90)turtle.fd(-75)turtle.seth(0)turtle.fd(-180)turtle.pd()turtle.seth(-90)turtle.fd(40)turtle.seth(-180)turtle.color("black")turtle.pensize(15)turtle.fd(20)turtle.pensize(10)turtle.color((240, 128, 128))turtle.pu()turtle.seth(90)turtle.fd(40)turtle.seth(0)turtle.fd(90)turtle.pd()turtle.seth(-90)turtle.fd(40)turtle.seth(-180)turtle.color("black")turtle.pensize(15)turtle.fd(20)def drawTail():turtle.pensize(4)turtle.color((255, 155, 192))turtle.pu()turtle.seth(90)turtle.fd(70)turtle.seth(0)turtle.fd(95)turtle.pd()turtle.seth(0)turtle.circle(70, 20)turtle.circle(10, 330)turtle.circle(70, 30)def main():turtle.pensize(4)turtle.colormode(255)turtle.color((255, 155, 192), "pink")turtle.setup(1000, 600)turtle.speed(10)drawNose()drawHead()drawEar()drawEyes()drawBlush()drawLip()drawBody()drawHand()drawFoot()drawTail()turtle.done()if __name__ == '__main__':main()

效果图:

源码:

from turtle import *
#两个函数用于画心
def curvemove():for i in range(200):right(1)forward(0.1)
def heart(x,y,s):pu()goto(x,y)seth(s)pendown()begin_fill()left(140)forward(11.1)curvemove()left(120)curvemove()forward(11.1)end_fill()
#初始化
# setup(600,600)
pu()
goto(60,100)
pensize(4)
pendown()
#画左半边的头
for i in range(150,212,2):seth(i)fd(3)
seth(145)
fd(50)
left(125)
fd(50)
for i in range(240,318,2):if i==290:seth(190)fd(10)seth(10)fd(10)elif i==300:seth(200)fd(10)seth(20)fd(10)seth(i)fd(3)
#画右半边的头
pu()
goto(60,100)
pendown()
seth(45)
fd(50)
right(125)
fd(50)
for i in range(-60,-138,-2):if i==-110:seth(-10)fd(10)seth(170)fd(10)elif i==-120:seth(-20)fd(10)seth(160)fd(10)seth(i)fd(3)
#头部到这里就画好外观了
seth(-40)
fd(52)
seth(-135)
fd(45)
pu()
seth(-105)
fd(5)
pendown()
fd(17)
for i in range(130,106,-3):seth(i)fd(2.5)
for i in range(106,30,-10):seth(i)fd(2)
seth(38)
fd(25)
seth(135)
fd(31)
seth(169)
fd(6)
seth(270)
fd(105)
#右边的身子画好了
#开始画左边的身子
pu()
goto(-52,-30)
pendown()
seth(220)
fd(48)#52
seth(250)
fd(3)
seth(270)
fd(3)
seth(290)
fd(2)
seth(-40)
fd(44)
seth(228)
fd(20)
seth(5)
fd(22)
#画叉腰的动作
pu()
goto(-52,-84)
seth(133)
pendown()
fd(22)
seth(90)
fd(2)
seth(60)
fd(2)
seth(45)
fd(29)
seth(0)
fd(3)
seth(-93)
fd(102)
#叉腰动作结束 接下来画嘴巴 眼睛
pu()
goto(-43,38)
seth(0)
pendown()
begin_fill()
circle(5)
end_fill()
pu()
fd(108)
pendown()
begin_fill()
circle(5)
end_fill()
#调色环节
pu()
goto(60,24)
pencolor("pink")
pensize(6)
seth(225)
pendown()
fd(7)
pu()
goto(70,24)
seth(225)
pendown()
fd(7)
#右半边调色完毕
pu()
goto(-49,24)
seth(225)
pendown()
fd(7)
#画嘴巴
pu()
pensize(4)
pencolor("black")
goto(5,21)
seth(-45)
pendown()
fd(5)
goto(5,21)
seth(225)
fd(5)
#左边的颜色
pu()
pencolor("pink")
pensize(6)
goto(-39,24)
seth(225)
pendown()
fd(7)#给耳朵填充颜色
pu()
goto(-40,92)
seth(80)
pendown()
fillcolor("pink")
begin_fill()
circle(14,360,3)
end_fill()
pu()
goto(72,100)
seth(-74)
pendown()
begin_fill()
circle(14,360,3)
end_fill()
#酷酷的黑翅膀
pu()
pensize(4)
color('black', 'black')
begin_fill()
goto(-90,-35)
seth(135)
pendown()
fd(25)
seth(225)
fd(45)
seth(25)
fd(15)
seth(-80)
pensize(2)
fd(15)
seth(55)
fd(15)
seth(25)
fd(10)
seth(-80)
fd(15)
seth(75)
fd(15)
goto(-90,-35)
end_fill()
#最后一个翅膀
pu()
goto(125,-30)
seth(45)
pendown()
begin_fill()
fd(25)
seth(-45)
fd(45)
seth(155)
fd(15)
seth(-80)
fd(15)
seth(120)
fd(17)
seth(170)
fd(15)
seth(-80)
fd(15)
seth(120)
fd(17)
goto(125,-30)
end_fill()# #画5颗心
speed(10)
color('red', 'pink')
pensize(2)
heart(0,140,0)
heart(-125,0,30)
heart(140,0,-30)
heart(145,-85,-30)
heart(-132,-85,30)
# exit.onclick()
done()

效果图:

基于Python-turtle库绘制小猪佩奇、小猫咪相关推荐

  1. python turtle画熊-Python使用turtle库绘制小猪佩奇(实例代码)

    turtle(海龟)是Python重要的标准库之一,它能够进行基本的图形绘制.turtle图形绘制的概念诞生于1969年,成功应用于LOGO编程语言. turtle库绘制图形有一个基本框架:一个小海龟 ...

  2. python turtle 绘图小猪佩奇,Python使用turtle库绘制小猪佩奇(实例代码)

    这篇文章主要介绍了Python使用turtle库绘制小猪佩奇,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下 turtle(海龟)是Python重要的标准库之一,它 ...

  3. python画棒棒糖程序_Python使用turtle库绘制小猪佩奇(实例代码)

    turtle(海龟)是Python重要的标准库之一,它能够进行基本的图形绘制.turtle图形绘制的概念诞生于1969年,成功应用于LOGO编程语言. turtle库绘制图形有一个基本框架:一个小海龟 ...

  4. 用turtle库绘制小猪佩奇

    ** 小猪佩奇源码 ** import turtle as zdef nose():# 鼻子z.pu()z.goto(-100, 100)z.pd()z.seth(-30)z.begin_fill() ...

  5. 使用Python turtle库画小猪佩奇

    使用turtle画小猪佩奇 from turtle import* speed(10) def nose(x,y):#鼻子penup()#提起笔goto(x,y)#定位pendown()#落笔,开始画 ...

  6. Python turtle库画小猪佩奇

    作者github.com/Monster12138/ 下载安装Python环境,将源码保存为.py格式 源码如下: # coding:utf-8 import turtle as t t.pensiz ...

  7. Python Turtle库绘制小黄脸表情包

    Python Turtle库绘制小黄脸表情包 下面只有一个表情的代码 #!/usr/bin/env python # -*- coding:utf-8 -*- __author__: "TC ...

  8. Python turtle库绘制复杂漫威蜘蛛侠Spiderman

    演示效果 点击播放:Python123平台 济南大学_盛亚琪_spiderman (https://www.python123.io/index/turtles/5c95d01e24577506dc7 ...

  9. python random库画多彩蟒蛇,Python Turtle库绘制蟒蛇

    使用Python Turtle库来绘制蟒蛇 import turtle引入了海龟绘图体系 使用setup函数,设定了一个宽650像素和高350像素的窗体,其位置左上角坐标是200,200 说明位置在距 ...

  10. 使用python turtle库绘制一个三角形_使用turtle库绘制一个叠加等边三角形,图形效果如下:...

    原博文 2020-09-14 23:11 − import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.pensize(1) ...

最新文章

  1. ASP.NET MVC WebApi 返回数据类型序列化控制(json,xml)
  2. 对ie6、ie7、ff兼容性的详细css hack介绍
  3. .pyc文件还原.py文件_从镜像文件还原分区 (系统还原)
  4. mysql myisam存储引擎_MySQL浅谈MyISAM存储引擎
  5. java readline 实现_基于自定义BufferedReader中的read和readLine方法
  6. linuxg下c++ 类导出_为什么PDF导出功能在SOLIDWORKS Electrical中不起作用?
  7. 本地如何搭建IPv6环境测试你的APP
  8. FreeSql (十四)批量更新数据
  9. 在python中可以使用for作为变量名对吗_python能用一个变量的值作为另一个变量的变量名吗?...
  10. mysql交叉查询教程_史上最简单的 MySQL 教程(二十六)「连接查询(上)」
  11. 【英语学习】【WOTD】billion 释义/词源/示例
  12. 【kafka】Kafka 幂等 Producer
  13. 大家有什么n刷的小说,可以推荐一下吗?
  14. C# Speech学习笔记(三)
  15. arduino智能浇花系统_自动浇花套件
  16. monty python读音-Monty Python
  17. [带权并查集] Jzoj P1503 体育场
  18. [Reinforcement Learning] 动态规划(Planning)
  19. flashfxp怎么传文件,小编教你flashfxp怎么传文件
  20. 爱上了我的司机 (6)

热门文章

  1. 分布式系统关注点——如何去实施「负载均衡」?
  2. Hyper-V 虚拟网络设置
  3. 过滤器显示一个路径下特定的文件
  4. 在阿里云上遇见更好的Oracle(四)
  5. HAProxy安装与配置(一)
  6. TimeSeriesChart按月进行统计时坐标对不齐的问题
  7. VI3之vCenterServer配置的备份与还原
  8. 常用的数据结构和算法
  9. (bower、grunt、gulp、jspm、karmam、webpack) 前端工程自动化开发工具
  10. php读取doc pdf文件,PHP读取创建txt,doc,xls,pdf类型文件