转载自:http://bbs.51cto.com/thread-1557505-1.html
源码:

# coding:utf-8
import turtle as tt.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.08t.lt(3) #向左转3度t.fd(a) #向前走a的步长else:a=a-0.08t.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.08t.lt(3) #向左转3度t.fd(a) #向前走a的步长else:a=a-0.08t.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)
t.done()

新建一个txt文本把代码拷贝进去,然后修改文件后缀为"py"之后直接点击即可运行小猪佩奇的动画。
前提是安装好python的环境。效果:

Pytnon画一个小猪佩奇相关推荐

  1. 用python画甜小兔_Python 实现画一个小猪佩奇

    ===================================== 看到 佩奇的广告片刷红,为了迎接猪年,咱们也来用Python  画板实现一个效果吧 from turtle import* ...

  2. div+css画一个小猪佩奇

    用DIV+CSS画一个小猪佩奇,挺可爱的,嘻嘻. 1.HTML部分:(全是DIV) <!-- 小猪佩奇整体容器 --> <div class="pig_container& ...

  3. 干货!用C语言画一个小猪佩奇(附源码),针不戳!

    分享下如何用 C 语言画小猪佩奇使用带符号距离场(signed distance field, SDF)表示圆形:file:///C:\Users\Administrator.WIN- STED6B9 ...

  4. python代码画小猪佩奇_用 Python 画一个小猪佩奇和哆啦 A 梦

    0 前言 最近发现了很有意思的东西,有人用 turtle 这个库画了一个小猪佩奇,跑去 GitHub 看了一下代码,发现写这个的人真的很有耐心,居然能写下来. 再找了找,发现有人还画了哆啦 A 梦, ...

  5. python绘图turtle小猪_turtle作图:用turtle画一个小猪佩奇(详解!)

    之前的一篇文章大致说了一下turtle这个模块的基本操作,不知道的朋友可以去看看,真的超级简单:python:turtle作图基础. 准备用turtle来画一个网红猪--小猪佩奇. 在这之前,我们先聊 ...

  6. 用python的turtle库画一个小猪佩奇

    小猪佩奇是一个可爱的小猪.她已经四岁了,与她的妈妈,爸爸,和弟弟乔治生活在一起.佩奇最喜欢做的事情是玩游戏,打扮的漂亮,度假,以及在小泥坑里快乐的跳上跳下和与小羊苏西(她最好的朋友)乔治(她的弟弟)一 ...

  7. python用turtle画小猪佩奇_turtle作图:用turtle画一个小猪佩奇(详解!)

    之前的一篇文章大致说了一下turtle这个模块的基本操作,不知道的朋友可以去看看,真的超级简单:python:turtle作图基础. 准备用turtle来画一个网红猪--小猪佩奇. 在这之前,我们先聊 ...

  8. 用Python画一个小猪佩奇

    星期天没事,给熊孩子画个佩琪玩玩~ #!/usr/bin/env python2 # coding=utf-8import turtle as tt.pensize(8) t.hideturtle() ...

  9. 用java画一个小猪佩奇_python 画个小猪佩奇

    #!/usr/bin/python#-*- coding: utf-8 -*- importturtle as tdef nose(x,y):#鼻子 t.pu() t.goto(x,y) t.pd() ...

最新文章

  1. CentOS 6.4下PXE+Kickstart无人值守安装操作系统
  2. 如何将zipoutputstream返回_excel:vlookup如何区间查找?如何使用通配符?如何多条件查找?...
  3. Boost:演示如何计算加权统计信息
  4. java mysql geo_GEO数据库简介
  5. (80)FPGA复位激励(function)
  6. smarty变量调节器
  7. vSphere 高级特性FT配置与管理
  8. WF4 Bata 2
  9. 【OpenCV】图像金字塔
  10. 小米运维—互联网企业级监控系统实践
  11. mysql replication 原理_MySQL Replication(复制)基本原理 | 学步园
  12. 使用vcpkg安装numcpp与opencv4[contrib,world]
  13. 正确的座机号码格式_固定电话的格式
  14. 最新章节 第138章 量子生物计算机,生生不息的世界
  15. Vue 兄弟组件之间的通信
  16. git学习(一)初始化
  17. 图文结合带你搞懂InnoDB MVCC
  18. 各位师兄妹,来刷腾讯了,好多经验...
  19. 终年33岁的印度数学天才,他的传奇人生让扎克伯格流泪
  20. AndroidStudio - - - 点击头像更换头像_菜单选择_相机拍照与相册获取

热门文章

  1. 【每日面试】2021北京联通Java一面
  2. opencv入门Vec3f
  3. 一个题目引发的数组和指针复习
  4. https利用360cdn实现网站加速
  5. 四五百蓝牙耳机哪个好?500元以内音质最好的蓝牙耳机
  6. Java项目服务器cpu占用过高怎么办?
  7. ctfshow七夕杯 writeup
  8. FinalShell使用教程:SSH链接Linux服务器
  9. FCAA答题练习收集记录
  10. 电话+电视+网络=“三位一体”?