okay the point of the program is to have the user select two points which would be the points that make up the base of the house, then they select a point inside the house that will serve as the center of a door, however if they click outside of the house my program should ask them to click a point a different point, that's where i'm having problems.
from graphics22 import *
def main():
win = GraphWin('House Builder', 800,600)
message = Text(Point(400,10),'Please click two points to make the body of the house')
message.draw(win)
p1 = win.getMouse()
p1.draw(win)
p2 = win.getMouse()
p2.draw(win)
base = Rectangle(p1,p2)
base.setFill("green")
base.draw(win)
distance = (p2.x - p1.x)
d = (distance/10)
message.setText('Please click inside the house to open a door')
p3 = win.getMouse()
p3.draw(win)
p4 = Point(p3.x-d,p1.y)
p5 = Point(p3.x+d,p3.y)
door = Rectangle(p4,p5)
door.setFill("orange")
for i in range(1):
if p4.x <= p1.x or p5.x >= p2.x:
break;
else:
door.draw(win)
message.setText('Please click two points inside the house to open a window')
p6 = win.getMouse()
p6.draw(win)
p7 = win.getMouse()
p7.draw(win)
window = Rectangle(p6,p7)
window.setFill("lightblue")
for i in range(1):
if p6.getX() < p1.getX() or p7.getX() > p2.getX():
message.setText('Please click two points INSIDE the house to open a window')
else:
window.draw(win)
win.getMouse()
win.close()
main()