Roger Travis
Roger Travis

Reputation: 8548

How to check if two object are overlapping in a Canvas widget?

Say I have objects within the Canvas with a tags 'stopped' and 'flying'.

How do I check if any of this objects overlap each other?

Upvotes: 2

Views: 8903

Answers (1)

Carlos Tasada
Carlos Tasada

Reputation: 4444

You can use the method find_overlapping

find_overlapping(x1, y1, x2, y2) => tuple
Returns a tuple of all items that overlap the given rectangle, or that are 
completely enclosed by it.

And then loop through the result list looking for your tag.

Upvotes: 2

Related Questions