1

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).

Aliaksandr S.
  • 1,064
  • 9
  • 20

1 Answers1

1

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.

Minijack
  • 726
  • 7
  • 23