![](/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.