Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

draw_pattern_version1(a_canvas, pattern_list, size, left, top) This function is passed five parameters: the Canvas object, a list of string elements, followed by three integer parameters. The

draw_pattern_version1(a_canvas, pattern_list, size, left, top)

This function is passed five parameters: the Canvas object, a list of string elements, followed by three integer parameters. The function draws a grid of coloured rectangles inside the canvas area. The left-top position of the grid of coloured rectangles is given by the last two parameter values and the size of each rectangle is given by the size parameter. Each element of the pattern_list parameter is a string of digits and each element corresponds to one row of coloured rectangles. Each digit of the string element dictates the colour of the rectangle, e.g., the digit 1 means that the rectangle is filled with red, the digit 2 means that the rectangle is filled with blue, the digit 3 means that the rectangle is filled with green, etc. Note that the first two lines of this function are (you may use any colours of your choice):

possible_digits = "12345" colours = ["red", "blue", "green", "yellow", "black"]

Once you have completed this function you should see rows of coloured rectangles (of varying lengths) on the left hand side of the canvas area.

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

Step: 3

blur-text-image

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

User Defined Tensor Data Analysis

Authors: Bin Dong ,Kesheng Wu ,Suren Byna

1st Edition

3030707490, 978-3030707491

More Books

Students also viewed these Databases questions

Question

=+Were these signals effective?

Answered: 1 week ago