Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I have a program that I want to keep looping uptil the user clicks in the window. It is a ball bouncing around in a window using the graphics module. I tried using win.getmouse() and then win.close(), but then it has to wait between every loop and will only go once.
for i in range(0,700):
xdir,ydir = slope(x,y,xdir,ydir)
color,n = shader(x,y,color,n)
x = x + xdir
y = y + ydir
circ = Circle(Point(x,y), 4)
I've searched the python documentation, but don't see anything that will do this. I was thinking of something like onclick, but I can't find anything like that.
0 · ·