shanzhi - 哆啦A梦

import turtle as t

# 头部
def head():
    t.up()
    t.circle(150,40)
    t.down()
    t.fillcolor("#00a0de")
    t.begin_fill()
    t.circle(150,280)
    t.end_fill()

# 围巾
def scarf():
    t.fillcolor("#e70010")
    t.begin_fill()
    t.seth(0)
    t.fd(200)
    t.circle(-5,90)
    t.fd(10)
    t.circle(-5,90)
    t.fd(207)
    t.circle(-5,90)
    t.fd(10)
    t.circle(-5,90)
    t.end_fill()


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

def face():
    t.fd(183)
    t.fillcolor('white')
    t.begin_fill()
    t.lt(45)
    t.circle(120,100)
    t.seth(90)
    eyes()

    t.seth(180)
    t.up()
    t.fd(60)
    t.down()
    t.seth(90)
    eyes()

    t.seth(180)
    t.up()
    t.fd(64)
    t.down()

    t.seth(215)
    t.circle(120,100)
    t.end_fill()

def nose():
    t.up()
    t.goto(-10,158)
    t.down()
    t.fillcolor("#CD0000")
    t.begin_fill()
    t.circle(20)
    t.end_fill()

def mouth():
    t.up()
    t.goto(5,148)
    t.down()
    t.seth(270)
    t.fd(100)
    t.seth(0)
    t.circle(120,50)
    t.seth(230)
    t.circle(-120,100)

def beard():
    t.up()
    t.goto(-32, 135)
    t.down()
    t.seth(165)
    t.fd(60)

    t.up()
    t.goto(-32, 125)
    t.down()
    t.seth(180)
    t.fd(60)

    t.up()
    t.goto(-32, 115)
    t.down()
    t.seth(193)
    t.fd(60)

    t.up()
    t.goto(42, 135)
    t.down()
    t.seth(15)
    t.fd(60)

    t.up()
    t.goto(42, 125)
    t.down()
    t.seth(0)
    t.fd(60)

    t.up()
    t.goto(42, 115)
    t.down()
    t.seth(-13)
    t.fd(60)

def blackeyes():
    t.seth(0)
    t.up()
    t.goto(-20, 195)
    t.down()
    t.fillcolor('#000000')
    t.begin_fill()
    t.end_fill()

    t.pensize(6)
    t.up()
    t.goto(20, 205)
    t.down()
    t.seth(75)
    t.circle(-10, 150)
    t.pensize(3)

    t.up()
    t.goto(-17, 200)
    t.down()
    t.seth(0)
    t.fillcolor('black')
    t.begin_fill()
    t.circle(8)
    t.end_fill()
    t.up()
    t.goto(0, 0)
    t.down()


def bell():
    t.up()
    t.goto(-103.42, 15.09)
    t.down()
    t.fd(90)
    t.seth(70)
    #
    t.color('black')
    t.fillcolor("#FFFF00")

    t.begin_fill()
    t.circle(-20)
    t.end_fill()
    t.seth(170)
    t.begin_fill()
    t.circle(-2,180)
    t.seth(10)
    t.circle(-100,22)
    t.circle(-2,180)
    t.seth(170)
    t.circle(100,22)
    t.end_fill()
    t.goto(-13.42, 15.09)
    t.seth(250)
    t.circle(20,110)
    t.seth(90)
    t.fd(23)
    t.dot(10)


# body
def body():
    t.up()
    t.goto(0, 0)
    t.down()
    t.seth(0)
    t.penup()
    t.circle(150,50)

t.pensize(3)
t.screensize(800,600,"#B0C4DE")
# t.tracer(False)
t.speed(10)
head()
scarf()
face()
nose()
mouth()
beard()
blackeyes()
bell()
body()




t.done()





发布了414 篇原创文章 · 获赞 19 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/104595662