[python]代码库
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-11 22:50:45 顶(0) | 踩(0) 回复
nbkjholinljknj
回复评论