猫史档案馆


(画机器猫)Python作品分享

用户:子俊m7ew子俊m7ew查看:0 回复:1 评论:0 创建时间:2021-03-13T17:01:03


import turtle
import time
print('10秒后教你怎么画多啦a梦')
time.sleep(10)
print('''
def line(x,y,to,how_long):

    a.penup()
    a.goto(x, y)
    a.setheading(to)
    a.pendown()
    a.forward(how_long)

def eye():

    a.begin_fill()
    for __count in range(90):
        a.forward(0.7)
        a.right(4)
    a.end_fill()
    a.dot(10)

a = turtle.Pen()
a.hideturtle()
a.begin_fill()

a.fillcolor(0, 120, 255)
a.circle(80)
a.end_fill()
a.begin_fill()
a.fillcolor(255, 255, 255)
a.circle(60)
a.end_fill()
a.penup()
a.goto((-30), 134)
a.pendown()
eye()
a.penup()
a.forward(60)
a.pendown()
eye()
a.penup()
a.goto(0, 50)
a.pendown()
a.fillcolor("#cc0000")
a.begin_fill()
for __count in range(80):
    a.forward(1.2)
    a.right(4.5)
a.end_fill()
a.penup()
a.goto(0, 75)
a.dot(15)
line(-25, 85, 145, 25)
line(-25, 60, 180, 25)
line(-25, 35, -145, 25)
line(25, 85, -145, -25)
line(25, 60, -180, -25)
line(25, 35, 145, -25)
a.penup()
a.goto(10,0)
a.fillcolor(255,255,0)
a.begin_fill()
a.circle(20)
a.end_fill()''')
time.sleep(5)
def line(x,y,to,how_long):

    a.penup()         
    a.goto(x, y)        #画胡子的地方
    a.setheading(to)       #面向
    a.pendown()
    a.forward(how_long)

def eye():

    a.begin_fill()
    for __count in range(90):   #画白色眼睛
        a.forward(0.7)
        a.right(4)
    a.end_fill()
    a.dot(10)  #眼球

#开始画多啦a梦
a = turtle.Pen()
a.hideturtle()
a.begin_fill()

a.fillcolor(0, 120, 255) #画蓝色脸
a.circle(80)
a.end_fill()
a.begin_fill()
a.fillcolor(255, 255, 255) #填充白色
a.circle(60)
a.end_fill()
a.penup()
a.goto((-30), 134)  #画左眼
a.pendown()
eye()
a.penup()
a.forward(60)   #画右眼
a.pendown()
eye()
a.penup()
a.goto(0, 50) #画嘴巴
a.pendown()
a.fillcolor("#cc0000")  #红色嘴巴
a.begin_fill()
for __count in range(80):  #圈
    a.forward(1.2)
    a.right(4.5)
a.end_fill()
a.penup()
a.goto(0, 75) #画鼻子
a.dot(15)
line(-25, 85, 145, 25)  #第1根胡子
line(-25, 60, 180, 25)   #第2根胡子
line(-25, 35, -145, 25)   #第3根胡子
line(25, 85, -145, -25)  #第4根胡子
line(25, 60, -180, -25)  #第5根胡子
line(25, 35, 145, -25)   #第6根胡子
a.penup()
a.goto(10,0)   #画铃铛
a.fillcolor(255,255,0)  #黄色铃铛
a.begin_fill()
a.circle(20)
a.end_fill()  
#画完了


回复

上一页1 页 / 共 1下一页
SKQASKQA

翻 白 眼

点赞0


评论