As a continuation of the preceding recipe, we can detect whether a rectangle item overlaps with another one. In fact, this can be achieved, assuming that we are working with shapes contained in rectangular boxes, using the find_overlapping() method from the Canvas class.
Detecting collisions between items
Getting ready
This application extends the preceding one by adding four green rectangles to the canvas and highlighting the one that is touched by a blue rectangle moved using the arrow keys:
How to do it...
Since this script has many similarities with the preceding...