[Tkinter-discuss] Tix HList missing at least one method

Michael Lange klappnase at web.de
Fri Aug 31 10:05:05 CEST 2007

On Wed, 29 Aug 2007 15:54:46 -0400
"Ron Provost" <ronpro at cox.net> wrote:

> According to the Tix documentation online, HList has an info_bbox() method which returns the bounding box of a given item in the HList.  However, when I try to call this method, I get an attribute error.  Looking at Tix.py I see that info_bbox() is not implemented.
> Hazarding a chance (mostly by looking at the other method implementation) I see if I can define it myself.
> def info_bbox( self, entry ):
>    return [ int(pos) for pos in self.tk.call( self._w, 'info', 'bbox', entry).split() ]
> When I use this implementation it works.  Why's info_bbox() been left out of HList?

Hi Ron,

this is not much of a surprise to me, there are more things missing from the Tix module.
Probably it is the best to use your "private" Tix module with the added info_bbox() method.
If you like you can send a patch to the python developers to fix this.
BTW, maybe there is a bug in your implementation of info_bbox(), it will fail if the tcl method
returns an empty string which might happen if the named item does not exist or so. You better
use self._getints() as in Tkinter.Canvas.bbox() :

    def info_bbox( self, entry ):
        return self._getints(self.tk.call(self._w, ´info´, 'bbox', entry)) or None

I hope this helps


More information about the Tkinter-discuss mailing list