write a program that graphically plots a regression line, that is, the line with the best fit through a collection of points.First ask the user to specify the data points by clicking on them in a graphics window. To find the end of input place a small rectangle labeled done in the lower left corner of the window; the program will stop gathering points when the user clicks inside that rectangle.
Please Help this is what I have....
from graphics import*
def main():
#Make Graphics Window
win=GraphWin("",700,700)
win.setCoords(-10,-10,10,10)
#Make the Done Button
done_button=Rectangle(Point(7,-9),Point(10,-10))
done_button.setFill("White")
done_button.draw(win)
done_text=Text(Point(8.5,-9.5),"Done")
done_text.setTextColor("Black")
done_text.draw(win)
p1=win.getMouse()
x=p1.getX()
y=p1.getY()
while x<=7 and y>= -9:
Cir=Circle(p1,.2)
Cir.setFill("Red")
Cir.draw(win)
p1=win.getMouse()
x=p1.getX()
y=p1.getY()
#Calculate xbar, ybar, and slope, y for -10 and y for 10