用户:灿银查看:0 回复:1 评论:0 创建时间:2020-02-06T12:02:40
【作品展示】

【作品介绍】
用海龟编辑器画一面五星红旗
【作品源代码】
import turtle
t = turtle.Turtle()
#国旗的旗面
t.up()
t.goto(-200, 200) # 从左上角为起始点
t.down()
t.begin_fill
t.fillcolor("red") # 旗面填充颜色为红色
t.pencolor("red") # 画笔颜色为红色
for i in range(2): # 绘制长方形旗面
t.forward(438) # 旗面的长度
t.right(90)
t.forward(292) # 旗面的宽度
t.right(90)
t.end_fill()
#绘制主五角星
t.t.fillcolor("yellow") # 五角星填充颜色为黄色
t.pencolor("yellow") # 画笔颜色为黄色
t.up()
t.goto(-170, 145) # 五角星的起始坐标
t.down()
t.begin_fill()
for x in range(5): # 循环5次画出五角星
t.forward(50)
t.right(144)
t.end_fill()
#第一颗辅五角星
t.up()
t.goto(-100, 180) # 五角星的起始坐标
t.setheading(305) # 设置画笔海龟的朝向
t.down()
t.begin_fill()
for i in range(5): # 循环5次画出五角星
t.forward(20)
t.right(144)
t.end_fill()
#第二颗辅五角星
t.up()
t.goto(-85, 150) # 五角星的起始坐标
t.setheading(300) # 设置画笔海龟朝向
t.down()
t.begin_fill()
for i in range(5): # 循环5次画出五角星
t.forward(20)
t.right(144)
t.end_fill()
#第三颗辅五角星
t.up()
t.goto(-85, 120) # 五角星的起始坐标
t.setheading(3) # 设置画笔海龟朝向
t.down()
t.begin_fill()
for i in range(5): # 循环5次画出五角星
t.forward(20)
t.right(144)
t.end_fill()
#第四颗辅五角星
t.up()
t.goto(-100, 100) # 五角星的起始坐标
t.setheading(300) # 设置画笔海龟朝向
t.down()
t.begin_fill()
for i in range(5): # 循环5次画出五角星
t.forward(20)
t.right(144)
t.end_fill()
t.hideturtle()
t.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn