Re: Making tktreectrl `just big enough'



You're doing it the only way it can be done. There isn't an auto-resize
feature in treectrl. The "bbox" command returns the size of the
window. You can use "bbox header" to get the size of the column
headers, and "bbox content" to get the display area of the items
inside the borders, but that includes any whitespace. So the total
height would be borders+headers+items.

-- Tim Baker


Hi all,

I would like to create a tktreectrl which requests only just enough
space to display its contents, but I can't figure out how to do this.
I am mainly interested in setting the height appropriately, rather
than the width.

The -height option has a `0 or negative' value option which I though
might work, but it doesn't. I then tried using the bbox command to
retrieve the actual height of the table, and plug that back in to the -
height config option, but bbox seems to return values which are too
big - the height is always about 1 row too big, leaving an empty gap
at the bottom of the table. The only way I have found that works so
far is to compute the height of an individual row (using item bbox),
multiplying that by the number of visible rows, and then setting the -
height from that.

Surely there must be an easier way. Am I missing something?

I am using tktreectrl 2.2.3 and Tk 8.5.0.

thanks,

dan.


.


Quantcast