python用turtle库画一个风车

2024-03-05  本文已影响0人  pan_peter
from turtle import *
import time as t
def draw(r):
    pensize(4)
    goto(0,-150)
    pensize(1)
    for i in range(4):
        setheading(i * 90 + r)
        pu()
        goto(0, 0)
        pd()

        fillcolor('#50B2F8')
        begin_fill()
        forward(100)
        lt(150)
        forward(75)
        end_fill()

        fillcolor('#063EC5')
        begin_fill()
        lt(30)
        forward(40)
        lt(90)
        forward(35)
        end_fill()
        speed(0)

for c in range(10000000000000000000000000000000000000000000000000000):
    tracer(False)
    clear()
    draw(c)
    t.sleep(0.00001)
    hideturtle()
    tracer(True)
    done()

image.png
上一篇下一篇

猜你喜欢

热点阅读