猫史档案馆


[Python]五星红旗代码 拿走不谢

用户:爱Python的政政爱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()#阻止窗口关闭


回复

上一页1 页 / 共 1下一页
治愈绾兮治愈绾兮

你这也不对啊

点赞1


评论


11011100101000111101110010100011

小窗口还好,大窗口是真不对

点赞1


评论