Treeview:如何更改标题行的行高

Treeview: How to change rowheight of title row

我可以使用

更改ttk::treeview的正常行的行高
ttk::style configure MyStyle.Treeview -rowheight 25

但是这个命令不会改变标题行的行高。我该怎么做?

似乎确实有任何方法可以更改标题的高度。

您最好的办法是创建自定义字体并配置树视图标题 使用它。

'Heading' 是树视图标题样式的名称。

font create headingfont
font configure headingfont -size 13
ttk::style configure Heading -font headingfont

编辑:根据 Oliver Scholl 的回答,您可以使用:

ttk::style configure Heading -padding {0 20}

这会将 top/bottom 填充设置为 20,将 left/right 填充设置为 0。

 -padding 20 ; # left/top/bottom/right all the same
 -padding {0 20} ; # left/right, top/bottom
 -padding {0 20 0 20} ; # left, top, right, bottom

解决方案是

ttk::style configure Treeview.Heading -padding "0 0 0 0"

ttk::style configure Treeview.Heading -padding {0 0 0 0}

填充选项是一个顺序为{left top right bottom}的列表。