[Tkinter-discuss] Find_closest, bbox, and weirdness

Cameron Laird Cameron at phaseit.net
Thu Jan 18 22:21:49 CET 2007

On Thu, Jan 18, 2007 at 12:36:18PM -0800, Russell E Owen wrote:
> > Here was the plan: Compute the line that connects the centers of the 
> > text objects.  Figure out where that line intersects the bounding boxes 
> > of the texts, and draw the lines to the intersection points instead of 
> > center-to-center.
> > 
> > It all works ... except that I don't get the right bounding boxes.  
> > Here's the code:
> it sounds like object with ID 1 may be overlapping all the other 
> objects. Tk's find_closest is primitive in how it handles overlap.
> Unless you can guarantee that your text objects will never overlap I 
> suggest you find the closest one yourself. Keep a list of object coords 
> and scan through them. If the objects can be moved around then use a 
> callback to update the position.
?  I've had *great* results with "closest".  While I agree
that your approach should be kept in mind, it's not the 
first one I try when I'm in the situation I understand from
the original description.  Do you have any details on how
"closest" has failed for you?

More information about the Tkinter-discuss mailing list