[PYTHON] The instruction and the graphics.py file is attached. Please remember to download graphics.py in the same folder as this assignment.
python_assignment.docx

graphics.zip

Unformatted Attachment Preview

Due Date:
This assignment is due before 11:59 pm on Monday, March 18 th
Assignment Description:
The objective is to create a 300×400 Graphic window containing a series of 50×50 white-filled Rectangles
arranged in a grid pattern. In addition, two “controls” are displayed with the labels “RESET” and “QUIT”. Using
the mouse, the user can click on any of the Rectangles to change their fill color to black. Clicking the “RESET”
control will restore the white fill color to all Rectangles, and clicking the “QUIT” control closes the Graphics
window and exit the program.
An example of the completed assignment is here: https://youtu.be/Gr43jdSmPlo
Remember to download graphics.py and it must be in the same folder as this assignment
Steps For This Assignment:
1. Setup your Python file with an appropriate comments header
2. Define the make() function to create the Graphics window and all the objects
3. Define the clear() function to set the fill color of all the Rectangles in the grid to white
4. Define the clicked() function to detect clicks within the bounds of a Rectangle
5. Define the main() function
TO DO #2: Define make() function to create the Graphic objects
Write a function named make() that accepts no arguments and
creates the following:
• 300×400 Graphics window with a light grey background
• Two (2) 100×50 Rectangles, one green and red
• Text labels “RESET” and “QUIT” (see example)
• A 5 by 5 grid of 50×50 Rectangles with white fill color arranged
as shown in the example

The make() function should return the Graphics window and all of the
Rectangle objects.
HINT: Create a List containing all the Rectangles – the function could
then simply return the Graphics window and the List
TO DO #3: Define the clear() function to set the fill color of all
the Rectangles in the grid to white
Write a function named clear() that completes the following:
• Accepts the Rectangle objects in the 5 by 5 grid as arguments
• Sets the fill color of all the Rectangles to white
The clear() function should not return any values
TO DO #4: Define the clicked() function to detect clicks within the bounds of a Rectangle
Write a function named clicked() that accepts two (2) arguments: a mouse click Point and a Rectangle. The
clicked() function should return True if the mouse click is within the Rectangle and False otherwise
TO DO #5: Define the main() function
a function named main() that completes the following steps:
Initializes any necessary variables
Calls the make() function to create the Graphics window and objects
Defines a while loop that repeats until the QUIT control Rectangle has been clicked
o Waits for a mouse click
o If the click is in the RESET control, call the clear() function
o If the click is in one of the white Rectangles, change its fill color to black
• After the while loop terminates, close the Graphics window
Write



HINT: Use the clicked() function to determine if a mouse click is within each of the Rectangles

Our essay writing service fulfills every request with the highest level of urgency.
attachment