import turtle as t |
from random import randint,random |
def draw_star(points,size,col,x,y): |
t.penup() |
t.goto(x,y) |
t.pendown() |
angle = 180 - ( 180 / points) |
t.color(col) |
t.begin_fill() |
for i in range (points): |
t.fd(size) |
t.rt(angle) |
t.end_fill() |
|
t.bgcolor( 'dark blue' ) |
draw_star( 5 , 50 , 'yellow' , 0 , 0 ) |
|
for i in range ( 199 ): |
ranPts = randint( 2 , 5 ) * 2 + 1 |
ranSize = randint( 10 , 50 ) |
ranCol = (random(),random(),random()) |
ranX = randint( - 350 , 300 ) |
ranY = randint( - 250 , 250 ) |
t.speed( 0 ) |
|
draw_star(ranPts,ranSize,ranCol,ranX,ranY) |
初级程序员
by: 对江邀月 发表于:2021-11-18 14:43:54 顶(0) | 踩(0) 回复
回复评论