program is to take a collection of rectangles and display them on a canvas | Solution Aider

Write the following Python program in a Python class named Assignment7.py
The goal of this program is to take a collection of rectangles and display them on a canvas so that none of the rectangles overlap with each other. To accomplish this task, your program will define several methods and classes. Note: parameters and return values must be in the order they are listed in the assignment manual A class CustomCanvas CustomCanvas will have a constructor which takes two explicit arguments, height and width, which are expected to be of type int. The constructor will create and display a new Canvas object with the height and width provided. To do this, you will use Canvas, a built-in object defined in the python package tkinter. Documentation for the Canvas class can be found here: https://anzeljg.github.io/rin2/book2/2405/docs/tki… A class Rectangle Rectangle will have a constructor which takes four explicit parameters, height, width, x, and y. All four arguments are expected to be of type int. x and y represent the origin point of the given rectangle. The origin point will be the upper left corner. Parameters x and y should have default values of zero. The values received as parameters should be stored in instance variables of the same name. A function pack The pack function will have two parameters, allRect and canvasSize. allRect will be a list of Rectangle objects and canvasSize a tuple containing a canvas’ height and width (in that order). pack will take the given list of rectangles and determine a location for each rectangle so that each rectangle does not overlap another and each rectangle exists within the given canvas size. pack will then return a list of placed Rectangle objects. Each given rectangle must be included in the returned list. (Note: Each given rectangle is referring to the logical concept of the rectangle shape not the specific Rectangle object. Two Rectangle objects are logically equivalent if they have the same height and width. When generating the list of Rectangles to return, you can modify the given Rectangle objects or create new, but logically equivalent, Rectangle objects)

Don't use plagiarized sources. Get Your Custom Essay on
program is to take a collection of rectangles and display them on a canvas | Solution Aider
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT! Just from $10/Page
Order Essay
superadmin

Recent Posts

communication MA | Solution Aider

part one For this assignment you are to to watch: Shattered Glass Write a two…

3 years ago

Standard Project – WebServers | Solution Aider

Standard Project - WebServers. Instruction attached. Need all requirements, you do not have to make…

3 years ago

Discussion post 2 | Solution Aider

Read classmates post and respond with 100 words:The International Categorization of Diseases, Tenth Revision, Clinical…

3 years ago

case sttudy | Solution Aider

Most Americans have at least 1 issue that is most important to them. Economic issues…

3 years ago

Methodologies Report | Solution Aider

For this assignment, you are the court intake processor at a federal court where you…

3 years ago

outline about gender equality | Solution Aider

Use a standard outline format to lay out how you are going to write your…

3 years ago