作业_长方形

0

from turtle import Turtle,Screen
from random import randint,choice
t=Turtle()
s=Screen()
cs=['blue','red' ,'green','yellow','orange','cyan','purple','pink']
def 柳色新 (t,l,s,le):
                t.begin_fill()
                for x in range(2):
                                t.fd(l)
                                t.lt(90)
                                t.fd(le)
                                t.lt(90)
                t.end_fill()
w=s.window_width()
h=s.window_height()
while True:
                c=randint(-w//2,w//2)
                v=randint(-h//2,h//2)
                b=randint(10,100)
                t.penup()
                t.goto(c,v)
                t.color(choice(cs))
                s.bgcolor(choice(cs))
                t.pendown()
                柳色新(t,b,s,(b*2))
0

发表评论