【发布时间】:2022-01-20 02:47:24
【问题描述】:
我正在为我的介绍类开发一个 python 项目,我想用海龟模块制作暴风雪。到目前为止,我已经能够在每个按键上出现一个“雪花”,但我不知道如何使它成为一个条件循环,当我点击它时,它会变成真的并继续循环,而无需我再次点击。
这是我现在拥有的代码:
def snowing(x, y):
w.speed(0)
flake_size = randint(1, 5)
rx = randint(-250, 250)
ry = randint(-300, 300)
w.color(colours[5])
w.setposition(rx, ry)
w.pendown()
w.begin_fill()
w.circle(flake_size)
w.end_fill()
w.penup()
listen()
onscreenclick(snowing, add=None)
【问题讨论】:
标签: python turtle-graphics python-turtle