The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 15,178     Votes:  6 
Tags: python   tkinter   treeview   hidpi  
Link: 🔍 See Original Answer on Stack Overflow ⧉ 🔗

Title: How can I set the row height in Tkinter TreeView?
ID: /2019/12/30/How-can-I-set-the-row-height-in-Tkinter-TreeView_
Created: December 30, 2019    Edited:  December 30, 2019
Upload: September 20, 2023    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false

I already have a variable setup for font size and would like to avoid setting up a variable for row height. So my code looks like this:

style = ttk.Style()
style.configure("Treeview.Heading", font=(None, LARGE_FONT), \
style.configure("Treeview", font=(None, MON_FONTSIZE), \

When LARGE_FONT is set to 14, the row height is set to 35. When MON_FONTSIZE is set to 12, the row height is calculated as 30.

The end result has the correct spacing (IMO) for the system font. YMMV for other font families though:

wman gnome gsettings.png

⇧ Monitor Network usage widget histogram RPI4 Ubuntu 19.10 64bit Temperature Monitoring  ⇩