开发者

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

开发者 https://www.devze.com 2022-12-23 02:50 出处:网络
Say I have objects wit开发者_如何学运维hin the Canvas with a tags \'stopped\' and \'flying\'.

Say I have objects wit开发者_如何学运维hin the Canvas with a tags 'stopped' and 'flying'.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消