用python画出你的童年回忆

用python画出你的童年回忆

又到一年一度的国际儿童节,作为逢节必过的程序猿,怎么可以放过这个学习技能的机会呢?

于是,今天我们来学习python的turtle库绘制童年的卡通人物,一起做回年轻的那个少年。

一、Turtle图形库简介

Turtle库,又称海龟库,是Python语言中一个很流行的绘制图像的函数库,想象一个小乌龟,在一个横轴为x、纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它爬行的路径上绘制了图形。Turtle库一般python环境会自带,如果没有这个库查询一下安装方法。

二、常用函数

  • 画笔控制函数
    1. penup():抬起画笔;
    2. pendown():落下画笔;
    3. pensize(width):画笔宽度;
    4. pencolor(color):画笔颜色;color为颜色字符串或者rgb值
  • 运动控制函数
    1. forward(d)/fd(d):直行d个像素;
    2. circle(r, extent = None):绘制半径为r,角度为extent的弧形,圆心默认在海龟左侧距离r的位置;
  • 方向控制函数
    1. setheading(angle)/seth(angle):改变前进方向;
    2. left(angle):海龟左转;
    3. right(angle):海龟右转;

三、代码演示

用海龟库完成小猪佩奇的绘制

# 小猪佩奇
import turtle as t

t.begin_fill()
t.pensize(4)
t.hideturtle()
t.colormode(255)
t.color((255, 155, 192), "pink")
t.setup(840, 500)
t.speed(10)



# 写字
#设置字体颜色
t.pencolor("PINK")
#起笔
t.penup()
#设定坐标
t.goto(-215,70)
#设置写字内容和字体、字号
t.write("儿童节快乐", move=False, align='center', font=("微软雅黑", 25, 'normal'))
# 鼻子
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)
t.end_fill()
#结束绘画
t.done()

运行截图:

用海龟库绘制皮卡丘头部

#绘制皮卡丘头部
from turtle import *


def face(x, y):
    """画脸"""
    begin_fill()
    penup()
    # 将海龟移动到指定的坐标
    goto(x, y)
    pendown()
    # 设置海龟的方向
    setheading(40)

    circle(-150, 69)
    fillcolor("#FBD624")
    # 将海龟移动到指定的坐标

    penup()
    goto(53.14, 113.29)
    pendown()

    setheading(300)
    circle(-150, 30)
    setheading(295)
    circle(-140, 20)
    print(position())
    forward(5)
    setheading(260)
    circle(-80, 70)
    print(position())
    penup()
    goto(-74.43, -79.09)
    pendown()

    penup()
    # 将海龟移动到指定的坐标
    goto(-144, 103)
    pendown()
    setheading(242)
    circle(110, 35)
    right(10)
    forward(10)
    setheading(250)
    circle(80, 115)
    print(position())

    penup()
    goto(-74.43, -79.09)
    pendown()
    setheading(10)
    penup()
    goto(-144, 103)

    pendown()
    penup()
    goto(x, y)
    pendown()

    end_fill()

    # 下巴
    penup()
    goto(-50, -82.09)
    pendown()
    pencolor("#DDA120")
    fillcolor("#DDA120")
    begin_fill()
    setheading(-12)
    circle(120, 25)
    setheading(-145)
    forward(30)
    setheading(180)
    circle(-20, 20)
    setheading(143)
    forward(30)
    end_fill()
    # penup()
    # # 将海龟移动到指定的坐标
    # goto(0, 0)
    # pendown()


def eye():
    """画眼睛"""
    # 左眼
    color("black", "black")
    penup()
    goto(-110, 27)
    pendown()
    begin_fill()
    setheading(0)
    circle(24)
    end_fill()
    # 左眼仁
    color("white", "white")
    penup()
    goto(-105, 51)
    pendown()
    begin_fill()
    setheading(0)
    circle(10)
    end_fill()
    # 右眼
    color("black", "black")
    penup()
    goto(25, 40)
    pendown()
    begin_fill()
    setheading(0)
    circle(24)
    end_fill()
    # 右眼仁
    color("white", "white")
    penup()
    goto(17, 62)
    pendown()
    begin_fill()
    setheading(0)
    circle(10)
    end_fill()


def cheek():
    """画脸颊"""
    # 右边
    color("#9E4406", "#FE2C21")
    penup()
    goto(-130, -50)
    pendown()
    begin_fill()
    setheading(0)
    circle(27)
    end_fill()

    # 左边
    color("#9E4406", "#FE2C21")
    penup()
    goto(53, -20)
    pendown()
    begin_fill()
    setheading(0)
    circle(27)
    end_fill()


def nose():
    """画鼻子"""
    color("black", "black")
    penup()
    goto(-40, 38)
    pendown()
    begin_fill()
    circle(7, steps=3)
    end_fill()


def mouth():
    """画嘴"""
    color("black", "#F35590")
    # 嘴唇
    penup()
    goto(-10, 22)
    pendown()
    begin_fill()
    setheading(260)
    forward(60)
    circle(-11, 150)
    forward(55)
    print(position())
    penup()
    goto(-38.46, 21.97)
    pendown()
    end_fill()

    # 舌头
    color("#6A070D", "#6A070D")
    begin_fill()
    penup()
    goto(-10.00, 22.00)
    pendown()
    penup()
    goto(-14.29, -1.7)
    pendown()
    penup()
    goto(-52, -5)
    pendown()
    penup()
    goto(-60.40, 12.74)
    pendown()
    penup()
    goto(-38.46, 21.97)
    pendown()
    penup()
    goto(-10.00, 22.00)
    pendown()

    end_fill()

    color("black", "#FFD624")

    penup()
    goto(-78, 15)
    pendown()
    begin_fill()
    setheading(-25)
    for i in range(2):
        setheading(-25)
        circle(35, 70)

    end_fill()
    color("#AB1945", "#AB1945")
    penup()
    goto(-52, -5)
    pendown()
    begin_fill()
    setheading(40)
    circle(-33, 70)
    goto(-16, -1.7)
    penup()
    goto(-18, -17)
    pendown()
    setheading(155)
    circle(25, 70)
    end_fill()


def ear():
    """画耳朵"""
    # 左耳
    color("black", "#FFD624")
    penup()
    goto(-145, 93)
    pendown()
    begin_fill()
    setheading(165)
    circle(-248, 50)
    right(120)
    circle(-248, 50)
    end_fill()
    color("black", "black")
    penup()
    goto(-240, 143)
    pendown()
    begin_fill()
    setheading(107)
    circle(-170, 25)
    left(80)
    circle(229, 15)
    left(120)
    circle(300, 15)
    end_fill()

    # 右耳
    color("black", "#FFD624")
    penup()
    goto(30, 136)
    pendown()
    begin_fill()
    setheading(64)
    circle(-248, 50)

    right(120)
    circle(-248, 50)
    end_fill()
    color("black", "black")
    penup()
    goto(160, 200)
    pendown()
    begin_fill()
    setheading(52)
    circle(170, 25)
    left(116)
    circle(229, 15)
    left(71)
    circle(-300, 15)
    end_fill()

def setting():
    pensize(2)
    # 隐藏海龟
    hideturtle()
    speed(10)


def main():
    """主函数"""
    setting()
    face(-132, 115)
    eye()
    cheek()
    nose()
    mouth()
    ear()
    done()


if __name__ == '__main__':
    main()

运行截图:

用海龟库绘制哆啦A梦

import turtle


def flyTo(x, y):
    turtle.penup()
    turtle.goto(x, y)
    turtle.pendown()


def drawEye():
    turtle.tracer(False)
    a = 2.5
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a -= 0.05
        else:
            a += 0.05
        turtle.left(3)
        turtle.fd(a)
    turtle.tracer(True)


def beard():
    """ 画胡子, 一共六根
    """
    # 左边第一根胡子
    flyTo(-37, 135)
    turtle.seth(165)
    turtle.fd(60)

    # 左边第二根胡子
    flyTo(-37, 125)
    turtle.seth(180)
    turtle.fd(60)

    # 左边第三根胡子
    flyTo(-37, 115)
    turtle.seth(193)
    turtle.fd(60)

    # 右边第一根胡子
    flyTo(37, 135)
    turtle.seth(15)
    turtle.fd(60)

    # 右边第二根胡子
    flyTo(37, 125)
    turtle.seth(0)
    turtle.fd(60)

    # 右边第三根胡子
    flyTo(37, 115)
    turtle.seth(-13)
    turtle.fd(60)


def drawRedScarf():
    """ 画围巾
    """
    turtle.fillcolor("red")  # 填充颜色
    turtle.begin_fill()
    turtle.seth(0)  # 朝向右

    turtle.fd(200)  # 前进10个单位
    turtle.circle(-5, 90)

    turtle.fd(10)
    turtle.circle(-5, 90)

    turtle.fd(207)
    turtle.circle(-5, 90)

    turtle.fd(10)
    turtle.circle(-5, 90)

    turtle.end_fill()


def drawMouse():
    flyTo(5, 148)
    turtle.seth(270)
    turtle.fd(100)
    turtle.seth(0)
    turtle.circle(120, 50)
    turtle.seth(230)
    turtle.circle(-120, 100)


def drawRedNose():
    flyTo(-10, 158)
    turtle.fillcolor("red")  # 填充颜色
    turtle.begin_fill()
    turtle.circle(20)
    turtle.end_fill()


def drawBlackdrawEye():
    turtle.seth(0)
    flyTo(-20, 195)
    turtle.fillcolor("#000000")  # 填充颜色
    turtle.begin_fill()
    turtle.circle(13)
    turtle.end_fill()
    turtle.pensize(6)
    flyTo(20, 205)
    turtle.seth(75)
    turtle.circle(-10, 150)
    turtle.pensize(3)
    flyTo(-17, 200)
    turtle.seth(0)
    turtle.fillcolor("#ffffff")
    turtle.begin_fill()
    turtle.circle(5)
    turtle.end_fill()
    flyTo(0, 0)


def drawFace():
    """
    """
    turtle.forward(183)  # 前行183个单位
    turtle.fillcolor("white")  # 填充颜色为白色
    turtle.begin_fill()  # 开始填充
    turtle.left(45)  # 左转45度
    turtle.circle(120, 100)  # 右边那半边脸
    turtle.seth(90)  # 朝向向上
    drawEye()  # 画右眼睛
    turtle.seth(180)  # 朝向左
    turtle.penup()  # 抬笔
    turtle.fd(60)  # 前行60
    turtle.pendown()  # 落笔
    turtle.seth(90)  # 朝向上
    drawEye()  # 画左眼睛
    turtle.penup()  # 抬笔
    turtle.seth(180)  # 朝向左
    turtle.fd(64)  # 前进64
    turtle.pendown()  # 落笔
    turtle.seth(215)  # 修改朝向
    turtle.circle(120, 100)  # 左边那半边脸
    turtle.end_fill()  #


def drawHead():
    """ 画了一个被切掉下半部分的圆
    """
    turtle.penup()  # 抬笔
    turtle.circle(150, 40)  # 画圆, 半径150,圆周角40
    turtle.pendown()  # 落笔
    turtle.fillcolor("#00a0de")  # 填充色
    turtle.begin_fill()  # 开始填充
    turtle.circle(150, 280)  # 画圆,半径150, 圆周角280
    turtle.end_fill()


def drawAll():
    drawHead()
    drawRedScarf()
    drawFace()
    drawRedNose()
    drawMouse()
    beard()
    flyTo(0, 0)
    turtle.seth(0)
    turtle.penup()
    turtle.circle(150, 50)
    turtle.pendown()
    turtle.seth(30)
    turtle.fd(40)
    turtle.seth(70)
    turtle.circle(-30, 270)
    turtle.fillcolor("#00a0de")
    turtle.begin_fill()
    turtle.seth(230)
    turtle.fd(80)
    turtle.seth(90)
    turtle.circle(1000, 1)
    turtle.seth(-89)
    turtle.circle(-1000, 10)
    turtle.seth(180)
    turtle.fd(70)
    turtle.seth(90)
    turtle.circle(30, 180)
    turtle.seth(180)
    turtle.fd(70)
    turtle.seth(100)
    turtle.circle(-1000, 9)
    turtle.seth(-86)
    turtle.circle(1000, 2)
    turtle.seth(230)
    turtle.fd(40)
    turtle.circle(-30, 230)
    turtle.seth(45)
    turtle.fd(81)
    turtle.seth(0)
    turtle.fd(203)
    turtle.circle(5, 90)
    turtle.fd(10)
    turtle.circle(5, 90)
    turtle.fd(7)
    turtle.seth(40)
    turtle.circle(150, 10)
    turtle.seth(30)
    turtle.fd(40)
    turtle.end_fill()

    # 左手
    turtle.seth(70)
    turtle.fillcolor("#FFFFFF")
    turtle.begin_fill()
    turtle.circle(-30)
    turtle.end_fill()

    #
    flyTo(103.74, -182.59)
    turtle.seth(0)
    turtle.fillcolor("#FFFFFF")
    turtle.begin_fill()
    turtle.fd(15)
    turtle.circle(-15, 180)
    turtle.fd(90)
    turtle.circle(-15, 180)
    turtle.fd(10)
    turtle.end_fill()
    flyTo(-96.26, -182.59)
    turtle.seth(180)
    turtle.fillcolor("#FFFFFF")
    turtle.begin_fill()
    turtle.fd(15)
    turtle.circle(15, 180)
    turtle.fd(90)
    turtle.circle(15, 180)
    turtle.fd(10)
    turtle.end_fill()

    # 右手
    flyTo(-133.97, -91.81)
    turtle.seth(50)
    turtle.fillcolor("#FFFFFF")
    turtle.begin_fill()
    turtle.circle(30)
    turtle.end_fill()

    # 口袋
    flyTo(-103.42, 15.09)
    turtle.seth(0)
    turtle.fd(38)
    turtle.seth(230)
    turtle.begin_fill()
    turtle.circle(90, 260)
    turtle.end_fill()
    flyTo(5, -40)
    turtle.seth(0)
    turtle.fd(70)
    turtle.seth(-90)
    turtle.circle(-70, 180)
    turtle.seth(0)
    turtle.fd(70)

    # 铃铛
    flyTo(-103.42, 15.09)
    turtle.fd(90)
    turtle.seth(70)
    turtle.fillcolor("#ffd200")
    turtle.begin_fill()
    turtle.circle(-20)
    turtle.end_fill()
    turtle.seth(170)
    turtle.fillcolor("#ffd200")
    turtle.begin_fill()
    turtle.circle(-2, 180)
    turtle.seth(10)
    turtle.circle(-100, 22)
    turtle.circle(-2, 180)
    turtle.seth(180 - 10)
    turtle.circle(100, 22)
    turtle.end_fill()
    flyTo(-13.42, 15.09)
    turtle.seth(250)
    turtle.circle(20, 110)
    turtle.seth(90)
    turtle.fd(15)
    turtle.dot(10)
    flyTo(0, -150)
    drawBlackdrawEye()


def main():
    turtle.screensize(800, 6000, "#F0F0F0")
    turtle.pensize(3)
    turtle.speed(9)
    drawAll()


if __name__ == "__main__":
    main()
    turtle.mainloop()

运行截图:

用海龟库绘制蜡笔小新

import turtle as t
'''设置'''
t.setup(800,500) # 创建画布并使其位于屏幕中心
t.pensize(2)  #  画笔粗细
t.colormode(255)  # 色彩模式
t.speed(5)  # 绘画速度
t.color('black',(255,228,181))  # 画笔颜色与填充色
t.shape('turtle')  # 画笔的形状
t.speed(5)  #画笔速度
t.showturtle() # 使画笔显现
#
t.pu()
t.goto(-150,10)
t.pd()
t.seth(0)
t.begin_fill()
t.left(135)
t.circle(-70,85)
t.right(8)
t.circle(-85,44)
t.left(10)
t.circle(40,61)
t.right(15)
t.fd(20)
t.right(5)
t.circle(-40,45)
t.left(6)
t.circle(-70,25)
t.left(18)
t.circle(-80,35)
t.left(10)
t.circle(-70,27)
t.circle(-120,54)

# 耳朵
t.pu()
t.goto(82,30)
t.pd()
t.left(140)
t.fd(20)
t.right(10)
t.circle(-20,65)
t.seth(-50)
t.fd(5)
t.right(13)
t.circle(-50,50)
t.right(10)
t.circle(-60,25)
t.right(7)
t.circle(-50,20)
t.circle(-10,90)

# 补充完整头部
t.pu()
t.goto(-150,10)
t.pd()
t.color('black',(255,228,181))
t.right(130)
t.circle(90,33)
t.right(16)
t.circle(370,28)
t.end_fill()

# 头发
t.color('black','black')
t.pu()
t.goto(-18,180)
t.pd()
t.begin_fill()
t.right(30)
t.circle(-350,19)
t.right(38)
t.circle(-300,17)
t.left(135)
t.fd(23)
t.left(39)
t.circle(120,63)
t.left(10)
t.circle(110,28)
t.right(11)
t.circle(85,14)
t.end_fill()

#眉毛
t.pu()
t.goto(-52,151)
t.pd()
t.begin_fill()
t.right(205)
t.circle(110,33)
t.circle(7,130)
t.left(50)
t.circle(-110,30)
t.circle(8,140)
t.end_fill()
t.pu()
t.goto(48,140)
t.pd()
t.begin_fill()
t.right(4)
t.circle(150,18)
t.right(4)
t.circle(-6,140)
t.right(28)
t.circle(-150,19)
t.right(10)
t.circle(-10,150)
t.end_fill()
t.pu()
t.goto(-69,126)
t.pd()
t.left(70)
t.circle(-80,37)
t.right(15)
t.circle(-25,100)
t.pu()
t.goto(2,91)
t.pd()
t.left(150)
t.circle(-70,30)
t.right(10)
t.circle(-40,60)
t.circle(-70,20)

#眼睛
t.pu()
t.goto(-60,110)
t.pd()
t.begin_fill()
t.right(52)
t.circle(27)
t.end_fill()
t.color('black','white')
t.pu()
t.goto(-45,110)
t.pd()
t.begin_fill()
t.right(24)
t.circle(20,80)
t.circle(7,100)
t.seth(40)
t.fd(22)
t.left(17)
t.circle(10,155)
t.end_fill()
t.pu()
t.goto(-20,95)
t.pd()
t.begin_fill()
t.left(70)
t.circle(-14,80)
t.circle(-7,120)
t.right(44)
t.circle(35,30)
t.end_fill()
t.pu()
t.goto(-41,77)
t.pd()
t.begin_fill()
t.left(28)
t.circle(6)
t.end_fill()
t.color('black','black')
t.pu()
t.goto(-5,55)
t.pd()
t.begin_fill()
t.left(10)
t.circle(-25)
t.end_fill()
t.color('black','white')
t.pu()
t.goto(5,57)
t.pd()
t.begin_fill()
t.left(40)
t.circle(-8,120)
t.left(30)
t.circle(-19,80)
t.circle(-8,120)
t.right(32)
t.circle(19,60)
t.right(55)
t.circle(-9,95)
t.end_fill()
t.pu()
t.goto(38,62)
t.pd()
t.begin_fill()
t.left(190)
t.circle(-15,50)
t.circle(-8,100)
t.right(40)
t.circle(-10,80)
t.end_fill()
t.pu()
t.goto(10,50)
t.pd()
t.begin_fill()
t.circle(-5)
t.end_fill()

#嘴巴
t.pu()
t.goto(-129,12)
t.pd()
t.circle(-40,35)
#身体
t.color('black',(205,32,32))
t.pu()
t.goto(-142,7)
t.pd()
t.begin_fill()
t.seth(-150)
t.fd(18)
t.seth(150)
t.fd(55)
t.left(105)
t.circle(-43,40)
t.right(125)
t.circle(-43,30)
t.left(180)
t.circle(43,30)
t.seth(-50)
t.fd(46)
t.circle(50,26)
t.left(27)
t.circle(60,50)
t.right(180)
t.circle(100,60)
t.seth(0)
t.fd(194)
t.left(120)
t.circle(-50,50)
t.fd(25)
t.right(20)
t.circle(34,66)
t.circle(18,116)
t.right(30)
t.circle(-90,18)
t.seth(135)
t.fd(12)
t.seth(-145)
t.fd(10)
t.right(46)
t.circle(-90,20)
t.circle(10,100)
t.circle(-60,20)
t.right(130)
t.circle(-50,20)
t.left(90)
t.circle(-370,6)
t.left(15)
t.circle(-90,13)
t.right(7)
t.circle(-90,18)
t.end_fill()
t.pu()
t.goto(-64,-33)
t.pd()
t.left(160)
t.circle(100,40)
t.circle(40,40)

#
t.color('black',(255,228,181))
t.pu()
t.goto(-62,-28)
t.pd()
t.begin_fill()
t.seth(140)
t.fd(8)
t.left(77)
t.circle(-12,150)
t.left(90)
t.fd(11)
t.circle(-4,120)
t.right(45)
t.fd(11)
t.left(130)
t.circle(20,35)
t.circle(-4,140)
t.right(30)
t.circle(-20,40)
t.left(160)
t.circle(20,40)
t.circle(-4,140)
t.right(20)
t.circle(-20,50)
t.left(190)
t.circle(-20,40)
t.circle(-3,130)
t.left(5)
t.circle(-20,60)
t.left(180)
t.circle(-20,40)
t.seth(25)
t.fd(10)
t.left(240)
t.circle(-30,30)
t.left(40)
t.circle(60,20)
t.seth(-30)
t.fd(7)
t.seth(-125)
t.fd(25)
t.end_fill()
t.pu()
t.goto(-212,3)
t.pd()
t.begin_fill()
t.seth(150)
t.fd(12)
t.left(90)
t.fd(8)
t.right(50)
t.circle(-9,90)
t.left(110)
t.fd(14)
t.right(40)
t.circle(-4,120)
t.right(15)
t.circle(-20,40)
t.left(180)
t.circle(-3,100)
t.left(123)
t.circle(-30,30)
t.circle(-3,150)
t.right(10)
t.circle(-30,30)
t.seth(80)
t.fd(3)
t.left(72)
t.circle(30,30)
t.right(8)
t.circle(-4,120)
t.right(43)
t.circle(-30,40)
t.seth(80)
t.fd(3)
t.left(70)
t.circle(30,34)
t.right(17)
t.circle(-4,120)
t.right(27)
t.circle(-20,90)
t.left(180)
t.circle(-20,50)
t.seth(35)
t.fd(8)
t.left(234)
t.circle(60,20)
t.seth(-33)
t.circle(-50,23)
t.seth(-119)
t.fd(16)
t.end_fill()
t.done()

运行截图:

 最后,组合把带给我们童年美好的这几个动画人物同框一次,到此你的童年集结完毕了吗?在这里衷心祝各位大儿童们节日快乐,继续保持童心,不断探索世界的美好!

posted @ 2020-05-31 02:47  两年半练习生  阅读(3113)  评论(0编辑  收藏  举报