Starting from:
$35

$29

Project 3: Five Gold (or Silver or Bronze) Rings Solution

For this project, you will begin with the same click.py example (now renamed to Olympic.py) that we saw in lab 5. That program creates a window on the screen and handles click events by printing the coordinates of the click. Previously, you explored the documentation of PyQt to learn how to draw rectangles on the window.

This time, we have provided the same skeleton window with a click handler, but your task is to draw the Olympic rings in the middle of the window. Details of the size and positioning of the rings are left to you, but they must be evenly spaced like in the official logo, and the logo must be horizontally centered on the screen. Below is the Olympic rings logo for your reference, though these images are plentiful online, as well.














Figure 1: The Olympic rings.

When the program runs, if the user clicks inside of a ring, a rectangle filled with the color of that ring should appear above the rings. If the user clicks in the intersection of two rings, then the rectangle should be evenly split with the left side receiving one color and the right side receiving the other color. When the program launches or when the user clicks outside of all rings, the rectangle should not be visible. Examples of my reference solution follow for clarity.

If you look closely, you'll see that the rings are not on top of each other. Instead, they interlock in a specific pattern. This interlocking appearance is not required for this project, but you will receive up to 10% bonus credit if you successfully accomplish it. You may see older versions of the logo that have gaps in the rings at the points of intersection; that version of the logo has been discontinued. There is no space between the colors when the rings intersect.

Because of all the coordinates involved, your implementation will contain several numeric constants. Make good use of CONSTANT_VARIABLES in your code.
EXAMPLES (NOT PRESCRIPTIONS)




























Figure 2: Program upon launch.



























Figure 4: Program when user clicks inside of the blue ring but not inside of the yellow ring.



























Figure 3: Program when the user clicks in
Figure 5: Program when the user clicks
the intersection of the blue and yellow
anywhere that is not inside of a ring.
rings.

SUBMISSION EXPECTATIONS

930xxxxxxx.pdf: A brief writeup describing the difficulties you encountered in this project and how you resolved them. Use your W&M ID number for the name of the file.

Olympic.py: The skeleton file attached to this project, but with your implementation of the rings and click behavior. To build this file, you will need to consult PyQt's documentation to locate methods of QPainter and other classes that would be helpful in your implementation. As a reminder, documentation is still only available for PyQt4, and we are using PyQt5. The only difference you should encounter for this project is the location of some modules to be imported. If you encounter trouble importing a particular module, post the problem on Piazza, and we will direct you to the correct import line.



The Olympic rings are presented here for academic purposes only. Do not advertise, sell, give away or in any way trade works bearing
Olympic properties without the consent of the International Olympic Committee.

More products