Before you begin this assignment, download and install (place in the correct spot) the graphics.py Python module which is necessary for this graphical assignment.
You are to write a program that allows the user to draw a simple house using five mouse clicks.
The window should be large enough to do this, the default sized window is
200x200, which is too small. Have a window of size 500x500, by using the line
win = GraphWin("House", 500, 500)
.
Click 1 and 2 will mark the lower left, and upper right of the rectangular frame of the house, respectively.
First, ask for click 1 with the prompt: Click on lower left corner of the house frame.
Then, ask for click 2 with the prompt: Click upper right corner of the house frame.
Click 3 will indicate the center of the top edge of a rectangular door. The door should have a total width that is 1/5 of the width of the house frame. The sides of the door should extend from the corners of the top all the way down to the bottom of the frame.
Hint: the width of the house is the difference between the x values of the two points.After the door is drawn, draw a doorknob. It should be placed at 1/2 of the door's height, and some reasonable distance from the door's right edge. The radius of the doorknob is up to you, so long as it is reasonable.
Hint: the height of the door is the difference of the y values of the lower house point and the top of the door.Click on the center of the top of the door.
Click 4 will indicate the center of a square window. The window is 3/4 as wide as the door.
After the window is drawn, draw the window's muntins (crosshatches). The lines of the muntins are required to be placed halfway of each edge of the window.
Click on the center of the window.
Click 5, the last click, will indicate the peak of the roof. The edges of the roof will extend from the point at the peak to the corners of the top edge of the house frame.
Click on the peak of the roof.
Click 6, prompting in the window Click anywhere to quit.
At this
point, the displayed graphics window should close.
See the following pictures to give an example of how your image should look at each step (although the exact positioning of objects will depend on where you click).
The title for this lab is hw3. Your submitted file is
required to be named hw3.py
.
Make sure to have a docstring that at least includes your name.
The rubric for this assignment is available through Gradescope, but an abbreviated one is available here