试图理解这段代码是如何工作的,谁能解释一下。
def draw_star(star): # drawing a star
# you only need to change a pixel, so use set_at, not draw.line
screen.set_at((star[0], star[1]), (255, 255, 255))
star[0] -= 1
if star[0] < 0:
star[0] = screen.get_width()
star[1] = random.randint(0, screen.get_height())
stars = []
for i in range(1200):
x = random.randint(0, screen.get_width())
y = random.randint(0, screen.get_height())
stars.append([x,y])
for star in stars:
draw_star(star)