Python绘制五星红旗

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Authur520/article/details/84895430

这里使用了python的turtle库,具体库里面的各函数的含义请参考这位网友的博客:

https://blog.csdn.net/zengxiantao1994/article/details/76588580

 本人目前Python小白,如果画的不好请各位网友多多指教。

#五星红旗
import turtle as t

t.setup(600,400,200,200)

t.speed(5)

t.penup()
t.goto(-100,-50)
t.pendown()
t.color("red","red")
t.pensize(2)
t.begin_fill()
for i in range(2):
    t.forward(240)
    t.left(90)
    t.forward(160)
    t.left(90)
t.end_fill()

t.color("yellow","yellow")
t.penup()
t.goto(-80,80)
t.pendown()
t.begin_fill()
for i in range(5):
    t.forward(30)
    t.right(144)
t.end_fill()


t.penup()
t.goto(-40,95)
t.pendown()
t.seth(-30)
t.begin_fill()
for i in range(5):
    t.forward(10)
    t.right(144)
t.end_fill()

t.penup()
t.goto(-40,55)
t.pendown()
t.begin_fill()
for i in range(5):
    t.forward(10)
    t.right(144)
t.end_fill()

t.penup()
t.goto(-25,62)
t.pendown()
t.seth(10)
t.begin_fill()
for i in range(5):
    t.forward(10)
    t.right(144)
t.end_fill()

t.penup()
t.goto(-25,78)
t.pendown()
t.seth(20)
t.begin_fill()
for i in range(5):
    t.forward(10)
    t.right(144)
t.end_fill()

t.penup()
t.goto(-130,-150)
t.pendown()
t.color("red","red")
t.write("Chinese flag", font=('Arial', 40, 'normal'))

t.done()

猜你喜欢

转载自blog.csdn.net/Authur520/article/details/84895430
今日推荐