Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ttk::treeview item height changeable?

2,676 views
Skip to first unread message

Zbigniew Diaczyszyn

unread,
Jul 12, 2010, 1:45:09 PM7/12/10
to
If the font is very large (e.g. 16 points) the tree content is not
fitting into the rows. Can the height of the rows for the whole widget
be changed?

Googling around for a solution I found the following note (Mon, 28 Apr
2008):

> ttk::treeview item height
> is essentially hardcoded: there's (currently) no (convenient) way
> to change it for individual items, or even for the widget as a whole.
> --Joe English

Is this still the actual state?

Trying "ttk::style element options treearea" doesn't show any option ...

Georgios Petasis

unread,
Jul 12, 2010, 1:52:04 PM7/12/10
to Zbigniew Diaczyszyn

I also had this issue, and my conclusion was that it is not
changeable... I haven't find a way to modify it...

George

Georgios Petasis

unread,
Jul 12, 2010, 1:53:10 PM7/12/10
to Zbigniew Diaczyszyn

I meant "haven't found"... :-)

George

Emiliano

unread,
Jul 12, 2010, 3:55:16 PM7/12/10
to
Zbigniew Diaczyszyn ha escrito:

> If the font is very large (e.g. 16 points) the tree content is not
> fitting into the rows. Can the height of the rows for the whole widget
> be changed?

This should do the trick (change the row height for the whole
widget):

set height 40
ttk::style configure Custom.Treeview -rowheight $height
$tree configure -style Custom.Treeview

Note that this option is undocumented, and it could go away
without notice, or the api changed, etc.

Regards

Emiliano

Zbigniew Diaczyszyn

unread,
Jul 13, 2010, 2:38:41 AM7/13/10
to
Am 12.07.2010 21:55, schrieb Emiliano:

> set height 40
> ttk::style configure Custom.Treeview -rowheight $height
> $tree configure -style Custom.Treeview
>
> Note that this option is undocumented, and it could go away
> without notice, or the api changed, etc.

Thank you, Emiliano,

I have tested the configuration successfully on Linux and MacOSX with
the following parameters:

set points 16
set rowheight [expr {$points * 2}]

ttk::style configure Custom.Treeview -rowheight $rowheight
$tree configure -style Custom.Treeview

If $rowheight is less then the double of $points then the treeview
display is cut.

Zbigniew

Joe English

unread,
Jul 15, 2010, 1:53:53 PM7/15/10
to
Zbigniew Diaczyszyn asked:

> If the font is very large (e.g. 16 points) the tree content is not
> fitting into the rows. Can the height of the rows for the whole widget
> be changed?
>
> Googling around for a solution I found the following note (Mon, 28 Apr
> 2008):
>
>> ttk::treeview item height
>> is essentially hardcoded: there's (currently) no (convenient) way
>> to change it for individual items, or even for the widget as a whole.
>> --Joe English
>
> Is this still the actual state?

Not completely. The "-rowheight" and "-indent" widget style options
are available:

ttk::style configure Treeview -rowheight $H -indent $I

(defaults are: -rowheight 20, -indent 20).

-rowheight applies to every item in the tree; there's still
no way to specify different heights for specific items.


--JE

Joe English

unread,
Jul 15, 2010, 1:59:11 PM7/15/10
to
Emiliano wrote:
> This should do the trick (change the row height for the whole
> widget):
>
> set height 40
> ttk::style configure Custom.Treeview -rowheight $height
> $tree configure -style Custom.Treeview
>
> Note that this option is undocumented, and it could go away
> without notice, or the api changed, etc.

That is correct -- it is undocumented, therefore subject to change
without notice, usual disclaimers apply, etc., etc., ...

However I'd give "-rowheight" a high probability of indefinite support,
so it's safe to use.


--JE

0 new messages