I'm stuck on this part of my program, im using graphics.py to implement a linear regression line. I think I'm making a stupid error but cant wrap my head around it. The BIG part I'm stuck on is that im supposed to make a "button" in the lower left corner to start the calculations and draw the regression lines, but I cant get out of the loop. Here is part of the function I am currently working/stuck on.
def gatherPointData(win):
"""Gathers mouse clicks via calls to getAndPlotPoint. Determines if
the click was in the 'Done' box. If not, accumulate the statistics
needed to calculate the equation of the best fit straight line."""
n=sumX=sumY=sumX2=sumXY=0
while True:
p = getAndPlotPoint(win)
x = p.getX()
y = p.getY()
if x <= 10 or y <= 5: break
sumX += x
sumY += y
sumX2 = x*x
sumXY += x*y
n += 1
return (n,sumX,sumY,sumX2,sumXY) # return a tuple with the stats