def ex_15_4_1(canvas): box = Rectangle() box.width = 300 box.height = 200 box.corner = Point() box.corner.x = -150 box.corner.y = -100 box.color = 'green4' draw_rect(canvas, box) pt = Point() pt.x = -25 pt.y = 0 draw_point(canvas, pt)
def create_rect(x, y, w, h): rect = Rectangle() rect.width = w rect.height = h rect.corner = create_point(x, y) return rect