![](/img/trans.png)
[英]How can i change the color background to row in treeview ( python tkinter)
[英]How can I set the row height in Tkinter TreeView?
s = ttk.Style()
s.configure('Treeview', rowheight=40) # repace 40 with whatever you need
我已经有一个字体大小的变量设置,并希望避免为行高设置变量。 所以我的代码看起来像这样:
style = ttk.Style()
style.configure("Treeview.Heading", font=(None, LARGE_FONT), \
rowheight=int(LARGE_FONT*2.5))
style.configure("Treeview", font=(None, MON_FONTSIZE), \
rowheight=int(MON_FONTSIZE*2.5))
当LARGE_FONT
设置为14
,行高设置为35
。 当MON_FONTSIZE
设置为12
,行高计算为30
。
最终结果具有系统字体的正确间距 (IMO)。 其他字体系列的 YMMV:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.