317 lines
4.3 KiB
Python
317 lines
4.3 KiB
Python
import turtle
|
|
t = turtle.Turtle()
|
|
# 画头
|
|
t.color('blue','blue')
|
|
t.penup()
|
|
# t.goto(0,100)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(75)
|
|
t.end_fill()
|
|
|
|
# 画脸
|
|
t.color('white','white')
|
|
t.penup()
|
|
# t.goto(0,72)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(60)
|
|
t.end_fill()
|
|
#画左眼框
|
|
t.color('black','white')
|
|
t.penup()
|
|
t.goto(-15,100)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(17)
|
|
# t.fillcolor('white')
|
|
t.end_fill()
|
|
|
|
# 画右眼眶
|
|
t.color('black','white')
|
|
t.penup()
|
|
t.goto(20,100)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(17)
|
|
# t.fillcolor('white')
|
|
t.end_fill()
|
|
|
|
|
|
# 画左眼珠
|
|
t.color('black')
|
|
t.penup()
|
|
t.goto(-8,110)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(7)
|
|
t.fillcolor('black')
|
|
t.end_fill()
|
|
t.penup()
|
|
t.goto(-7,115)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(3)
|
|
t.fillcolor('white')
|
|
t.end_fill()
|
|
|
|
# 画右眼珠
|
|
t.color('black')
|
|
t.penup()
|
|
t.goto(13,110)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(7)
|
|
t.fillcolor('black')
|
|
t.end_fill()
|
|
t.penup()
|
|
t.goto(12,115)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(3)
|
|
t.fillcolor('white')
|
|
t.end_fill()
|
|
|
|
|
|
#画鼻子
|
|
t.color('red','red')
|
|
t.penup()
|
|
t.goto(2,75)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(10)
|
|
# t.fillcolor('red')
|
|
t.end_fill()
|
|
|
|
# 画嘴巴
|
|
t.color('black')
|
|
t.penup()
|
|
t.goto(-25,35)
|
|
t.pendown()
|
|
t.setheading(-25) #设置小海龟启动时的运动方向
|
|
t.circle(60,55) #绘制一条弧线,表示机器猫的嘴巴
|
|
# # 画竖线
|
|
t.color('black')
|
|
t.penup()
|
|
t.goto(2,30) #将画笔移动到坐标(2,30)的位置
|
|
t.pendown()
|
|
t.goto(2,75) #绘制一条直线,表示机器猫的‘人中’
|
|
|
|
|
|
# 画胡子
|
|
# 左边第一根胡子
|
|
t.penup()
|
|
t.goto(-20,70)
|
|
t.pendown()
|
|
t.goto(-45,80)
|
|
|
|
# 左边第二根胡子
|
|
t.penup()
|
|
t.goto(-20,60)
|
|
t.pendown()
|
|
t.goto(-47,60)
|
|
|
|
# 左边第三根胡子
|
|
t.penup()
|
|
t.goto(-20,50)
|
|
t.pendown()
|
|
t.goto(-47,40)
|
|
|
|
# 右边第三根胡子
|
|
t.penup()
|
|
t.goto(20,50)
|
|
t.pendown()
|
|
t.goto(47,40)
|
|
|
|
|
|
# 右边第二根胡子
|
|
t.penup()
|
|
t.goto(20,60)
|
|
t.pendown()
|
|
t.goto(47,60)
|
|
|
|
|
|
# 右边第一根胡子
|
|
t.penup()
|
|
t.goto(20,70)
|
|
t.pendown()
|
|
t.goto(45,80)
|
|
|
|
|
|
# 绘制身体
|
|
# 1.绘制蓝色的身体
|
|
t.color('blue','blue')
|
|
t.penup()
|
|
t.goto(-55,0)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
# t.fillcolor('blue')
|
|
t.right(120)
|
|
t.goto(-55,-100)
|
|
t.left(90)
|
|
t.goto(55,-100)
|
|
t.left(90)
|
|
t.goto(55,0)
|
|
t.end_fill()
|
|
|
|
# 2.白色的大肚子
|
|
t.color('white','white')
|
|
t.penup()
|
|
t.goto(40,-45)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(40)
|
|
# t.fillcolor('white')
|
|
t.end_fill()
|
|
#
|
|
#3.红色的丝带
|
|
t.color('red','red')
|
|
t.penup()
|
|
t.goto(-70,5)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
# t.fillcolor('red')
|
|
t.right(120)
|
|
t.goto(-70,-5)
|
|
t.left(90)
|
|
t.goto(70,-5)
|
|
t.left(90)
|
|
t.goto(70,5)
|
|
t.end_fill()
|
|
|
|
# 4.白色的腿
|
|
t.color('white','white')
|
|
t.penup()
|
|
t.goto(14,-100)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.setheading(90)
|
|
# t.fillcolor('white')
|
|
t.circle(14,180)
|
|
t.end_fill()
|
|
|
|
|
|
# 机器猫的脚
|
|
# 1.左脚
|
|
t.color('black','white')
|
|
t.penup()
|
|
t.goto(-14,-110)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.setheading(90)
|
|
# t.fillcolor('white')
|
|
t.circle(20)
|
|
t.end_fill()
|
|
|
|
|
|
# 2.右脚
|
|
t.color('black','white')
|
|
t.penup()
|
|
t.goto(55,-110)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
# t.fillcolor('white')
|
|
t.circle(20)
|
|
t.end_fill()
|
|
|
|
|
|
# 绘制机器猫的胳膊
|
|
# 左胳膊
|
|
t.color('blue','blue')
|
|
t.penup()
|
|
t.goto(-55,-5)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.goto(-90,-50)
|
|
t.right(90)
|
|
t.goto(-70,-60)
|
|
t.right(90)
|
|
t.goto(-55,-30)
|
|
t.end_fill()
|
|
|
|
# 右胳膊
|
|
t.color('blue','blue')
|
|
t.penup()
|
|
t.goto(55,-5)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.goto(90,-50)
|
|
t.right(90)
|
|
t.goto(70,-60)
|
|
t.right(90)
|
|
t.goto(55,-30)
|
|
t.end_fill()
|
|
|
|
# 绘制机器猫的手
|
|
# 1.左手
|
|
t.color('black','white')
|
|
t.penup()
|
|
t.goto(-70,-60)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
# t.setheading(90)
|
|
t.circle(15)
|
|
t.end_fill()
|
|
|
|
# 2.右手
|
|
t.color('black','white')
|
|
t.penup()
|
|
t.goto(100,-65)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
t.circle(15)
|
|
t.end_fill()
|
|
|
|
|
|
# 绘制铃铛
|
|
# 1.黄色实心圆表示铜陵
|
|
t.color('yellow','yellow')
|
|
t.penup()
|
|
t.goto(10,-5)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
# t.fillcolor('yellow')
|
|
t.circle(10)
|
|
t.end_fill()
|
|
|
|
# 2.黑色矩形表示花纹
|
|
t.color('black','black')
|
|
t.penup()
|
|
t.goto(-10,0)
|
|
t.pendown()
|
|
t.left(90)
|
|
t.goto(-10,-5)
|
|
t.right(90)
|
|
t.goto(10,-5)
|
|
t.right(90)
|
|
t.goto(10,0)
|
|
t.right(90)
|
|
t.goto(-10,0)
|
|
|
|
|
|
# 3.黑色实心圆表示撞击的金属丸
|
|
t.color('black','black')
|
|
t.penup()
|
|
t.goto(-5,-10)
|
|
t.pendown()
|
|
t.begin_fill()
|
|
# t.fillcolor('black')
|
|
t.circle(5)
|
|
t.end_fill()
|
|
|
|
|
|
# #绘制口袋
|
|
t.penup()
|
|
t.goto(-26,-40)
|
|
t.pendown()
|
|
t.setheading(-90)
|
|
t.circle(25,180)
|
|
t.goto(-26,-40)
|
|
|
|
|
|
# 隐藏画笔
|
|
t.hideturtle()
|
|
turtle.done()
|
|
|
|
|