用户:
爱Python的政政查看:7 回复:2 评论:7 创建时间:2022-08-01T17:00:06
import turtle as t#导入海龟库
t.bgcolor('red')
t.speed(0) # 设置画笔速度
t.fillcolor('red') # 设置填充颜色为红色
t.setup(1280, 800, 0, 0)
t.pencolor('yellow') # 设置画笔颜色为黄色
t.fillcolor('yellow')#重新设置填充颜色为黄色
t.speed(0)#重新设置画笔速度为0
#画五角星函数:
def five_star(x,y,heading,喵):
t.penup()
t.goto(x,y)
t.setheading(heading)
t.pendown()
t.begin_fill()
for i in range(5):
t.forward(喵)
t.right(144)
t.end_fill()
#导入函数程序画图:
five_star(-520,240,0,240) #大红旗的位置
five_star(-230, 345, 305, 70)#第一个小红旗的位置
five_star(-150, 230, -8, 70)#第二个小红旗的位置
five_star(-150, 130, -35, 70)#第三个小红旗的位置
five_star(-230, 68, 300, 70)#第四个小红旗的位置
#打印程序:
print('祖国 喵你 我为你自豪')
#结束程序:
t.hideturtle()#隐藏画笔
t.done()#阻止窗口关闭