Python Grahics Homework (Using Graphics.py)

Posted Under: Coding

Ask A Question
DESCRIPTION
Posted
Modified
Viewed 20
This is a intro to python course. This homework requires us to use graphics.py by Zelle, to plot traffic lights. Specifically, the requirements are included in the pdf file, and feel free to discuss any details with me. Thank you in advance
Attachments
Lab 9: More Graphics Implementation Note: Make sure that graphics.py is on the same directory where you keep lab09.py You can find graphics.py in brightspace → Week 4 The graphics library does not work in Jupyter Notebook Question 1 In this exercise, you will write a Python program to simulate traffic lights graphically. Implement the trafficLights function that does the following Creates a Graphics Window of size 300 x 400, and is titled “Traffic Lights”. The window should have a “Close button”, and three “lights” within a “frame” as shown in the figure below; If the user clicks on any of the “lights”, it should “turn on”, as shown below; For example, if the user clicks on the top circle, the color should change from pink to red, if the user clicks on the middle circle, it should turn from a lighter shade of yellow to a brighter shade etc. You don’t have to get the colors exactly right but you need to make sure that the color must differentiably change when a circle is clicked. Note that only one color can be “on” at a time. So, if you have clicked on the red circle and it is on and another click was detected in the yellow circle, the red circle must turn off i.e., the color changes back to the lighter shade before the yellow light is turned on. If “Close” is clicked, the window closes without any errors. def trafficLights(): Parameters: - Return value: the function returns a window object The main is written for you def main(): window = trafficLights() main() Important notes: Comments: your program should have a header and comments that explain the solution steps. Save your file as lab09.py and upload it to Vocareum Rubric TASKS Distribution Question 1: 100% Total 100%
Explanations and Answers 0

No answers posted

Post your Answer - free or at a fee

Login to your tutor account to post an answer

Posting a free answer earns you +20 points.

Login

NB: Post a homework question for free and get answers - free or paid homework help.

Get answers to: Python Grahics Homework (Using Graphics.py) or similar questions only at Tutlance.

Related Questions