如何检查Canvas小部件中是否有两个对象重叠?

时间:2010-03-18 13:15:27

标签: python canvas tkinter overlap

假设我在Canvas中有标记为'stopped''flying'的对象。

如何检查这些物体是否相互重叠?

1 个答案:

答案 0 :(得分:2)

您可以使用方法find_overlapping

  

find_overlapping(x1, y1, x2, y2) =>   tuple

Returns a tuple of all items that overlap the given rectangle, or that are 
     完全被它封闭。

然后遍历结果列表,查找您的标记。