Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to write a Python program that allows the user to draw a simple house using five mouse clicks. The window should be large

You are to write a Python 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 linewin = GraphWin("House", 500, 500).

Click 1 and 2 will mark the lower left, and upper right of the rectangular frame of the house, respectively.

Draw these two prompts in the displayed graphics window, successively:

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.

Draw this prompt in the displayed graphics window:

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.

Draw this prompt in the displayed graphics 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.

Prompt in the window:

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.

image text in transcribed

Click anywhere to quit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions