Reputation: 1176
I have this program that makes dots move from the top to the bottom:
import graphics
import random
window = graphics.GraphWin("Snow!", 400, 400)
window.setBackground("skyblue")
flakes = []
for i in range(500):#generates snow
x = random.randint(0, 400)
y = random.randint(0, 400)
p = graphics.Point(x, y)
p.setFill("white")
p.draw(window)
flakes.append(p)
while True:#moves the 'snow'
for f in flakes:
f.move(0, 2)
if f.getY( ) > 399:
f.move(0, -400)
i want it to be closed any way or, using the:
getMouse()
statement while the 'snow is still falling'. If i prompt the user something it will just stop (freeze).
Upvotes: 1
Views: 258
Reputation: 685
You need to keep updating the screen while every tick get the mouse and see if it has clicked inside the graphics window.
See This Question for an example.
Upvotes: 1