Answer:
6. 5 Code Practice
Instructions
You should see the following code in your programming environment:
import simplegui
def draw_handler(canvas):
# your code goes here
frame = simplegui. Create_frame('Testing', 600, 600)
frame. Set_canvas_background("Black")
frame. Set_draw_handler(draw_handler)
frame. Start()
Using the house program we started in Lesson 6. 5 as a foundation, modify the code to add to the house drawing. Make additions to your house such as windows, doors, and a roof to personalize it
Step-by-step explanation:
def draw_handler(canvas):
# draw the house
canvas.draw_polygon([(100, 300), (100, 200), (200, 150), (300, 200), (300, 300)], 2, "White", "Brown")
# draw the windows
canvas.draw_polygon([(130, 250), (130, 220), (160, 220), (160, 250)], 2, "White", "White")
canvas.draw_polygon([(240, 250), (240, 220), (270, 220), (270, 250)], 2, "White", "White")
# draw the door
canvas.draw_polygon([(175, 300), (175, 240), (225, 240), (225, 300)], 2, "White", "Red")
# draw the roof
canvas.draw_polygon([(100, 200), (200, 150), (300, 200)], 2, "White", "Gray")
frame = simplegui.create_frame('Testing', 600, 600)
frame.set_canvas_background("Black")
frame.set_draw_handler(draw_handler)
frame.start()