猫史档案馆


【Python作品分享】国旗

用户:团子的宝藏汐云团子的宝藏汐云查看:1 回复:1 评论:1 创建时间:2021-03-07T14:38:32


【作品展示】

center_image

 

【作品介绍】

呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵呵

 

【作品源代码】

import turtle

t = turtle.Turtle()
# 国旗的旗面
t.penup()
t.goto((-200), 200)  # 从左上角为起始点
t.pendown()
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.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 x in range (5):  # 循环5次画出五角星
    t.forward(50)
    t.right(144)
t.end_fill()

# 第二颗小五角星
t.up()
t.goto(-85,150)    #五角星的起始位置
t.setheading(305)   #设置画笔海龟的朝向
t.down()
t.begin_fill()
for x in range (5):  # 循环5次画出五角星
    t.forward(50)
    t.right(144)
t.end_fill()

# 第三颗小五角星
t.up()
t.goto(-85,120)    #五角星的起始位置
t.setheading(305)   #设置画笔海龟的朝向
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,100)    #五角星的起始位置
t.setheading(305)   #设置画笔海龟的朝向
t.down()
t.begin_fill()
for x in range (5):  # 循环5次画出五角星
    t.forward(50)
    t.right(144)
t.end_fill()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
猫坑老鼠的小皓子猫坑老鼠的小皓子

歪了呀这

点赞0


评论