Question 7 Incorrect Mark 0.00 out of 1.50 Flag question Click here to download the template code to test your function in IDLE. First, complete the draw_shapes (a_canvas, start_x, start_y, grid_size, number_of_rows) function inside the template so that it draws a hollow right angle triangle as shown in the following picture. The number of rows in the triangle is given by the parameter, number_of_rows. You should work on your program using Python IDLE to produce the drawing then copy and paste the draw_shapes() function into CodeRunner to check the coordinates. t Note: • Submit the draw_shapes() function in the answer box below. • You must draw the triangle row by row starting from the top row, and from left to right within each row. For example: Test Result draw_shapes (a_canvas, 20, 30, 50, 3) Draw a blue rectangle at (20, 30) to (70, 80) Draw a blue rectangle at (20, 80) to (70, 130) Draw a blue rectangle at (70, 80) to (120, 130) Draw a blue rectangle at (20, 130) to (70, 180) Draw a blue rectangle at (70, 130) to (120, 180) Draw a blue rectangle at (120, 130) to (170, 180)
Lab09 (1).py - C:#Users#migco#Downloads#Lab09 (1).py (3.10.2) File Edit Format Run Options Window Help from tkinter import * def draw_shapes (a_canvas, start_x, start_y, size, number_of_rows): x_left= start_x y_down = start_y root = Tk () a_canvas = Canvas (root, width=600, height=400) a_canvas.pack (fill=BOTH, expand = True) draw_shapes (a_canvas, 20, 30, 50, 6) a_canvas.mainloop() I X
Question 7 Incorrect Mark 0.00 out of 1.50 Flag question Click here to download the template code to test your function
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am