teacher_code_python/机器猫的选择.py

168 lines
2.3 KiB
Python
Raw Normal View History

2024-07-17 09:09:48 +08:00
import turtle
t = turtle.Turtle()
t.speed(0)
# 画头
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.goto(-13,115)
t.pendown()
t.begin_fill()
t.circle(7)
t.fillcolor('black')
t.end_fill()
t.penup()
#t.goto(-7,115)
t.goto(-12,120)
t.pendown()
t.begin_fill()
t.circle(3)
t.fillcolor('white')
t.end_fill()
#笑眯眯
# t.penup()
# t.goto(-8,110)
# t.pendown()
# t.setheading(90)
# t.circle(7,180)
# 画右眼珠
t.color('black')
t.penup()
#t.goto(13,110)
t.goto(18,105)
t.pendown()
t.begin_fill()
t.circle(7)
t.fillcolor('black')
t.end_fill()
t.penup()
#t.goto(12,115)
t.goto(17,110)
t.pendown()
t.begin_fill()
t.circle(3)
t.fillcolor('white')
t.end_fill()
#笑眯眯
# t.penup()
# t.goto(25,110)
# t.pendown()
# t.setheading(90)
# t.circle(7,180)
#画鼻子
t.color('red','red')
t.penup()
t.goto(2,75)
#t.goto(-8,85)#笑眯眯
t.pendown()
t.begin_fill()
t.circle(10)
# t.fillcolor('red')
t.end_fill()
# 画嘴巴
t.color('black')
t.penup()
t.goto(-35,60)
t.pendown()
t.setheading(-85) #设置小海龟启动时的运动方向
t.circle(35,170) #绘制一条弧线,表示机器猫的嘴巴
# # 画竖线
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)
# 隐藏画笔
t.hideturtle()
2024-07-17 12:11:30 +08:00
turtle.done()
2024-07-17 09:09:48 +08:00