亲宝软件园·资讯

展开

超硬核!!25行代码教你画五星红旗

廖志丹 人气:1
import turtle as t
def pic(x,y,w,jd):
    t.speed(10)
    t.penup()
    t.goto(x,y)
    t.pendown()
    t.color("yellow")
    i=5
    t.begin_fill()
    t.setheading(jd)
    while i>0:
        t.fd(w)
        t.right(144)
        i-=1
    t.end_fill()
    t.hideturtle()
if __name__ == "__main__":
    t.setup(720,480)
    t.bgcolor("red")
    pic(-260,100,80,0)
    pic(-110,200,40,305)
    pic(-90,120,40,30)
    pic(-90,60,40,5)
    pic(-110,20,40,300)
    t.done()

效果图

加载全部内容

相关教程
猜你喜欢
用户评论