用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()

運行截圖:

 最后,組合把帶給我們童年美好的這幾個動畫人物同框一次,到此你的童年集結完畢了嗎?在這里衷心祝各位大兒童們節日快樂,繼續保持童心,不斷探索世界的美好!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM