Search code examples
font-sizegtk3gtktreeview

Header Widget in Gtk.TreeViewColumn


There is a Treeview with several TreeViewColumns. Because the default font-size is to big for my usage, I need to set the font-size in the TreeViewColumn Header.

I tried to following:

tvc = Gtk.TreeViewColumn()
tvcl = Gtk.Label("Test")
tvc.set_widget(tvcl)

But the Header of the Column is empty then. If it's possible to change the font of the TreeViewColumn().title, this would be enaugh.


Solution

  • Assuming you're using python (from the code), here's an example:

    from gi.repository import Gtk
    from gi.repository import Pango
    
    tvc           = Gtk.TreeViewColumn (None, renderer, col)
    custom_header = Gtk.Label ('Test')
    tvc.set_widget (custom_header)
    tvc.get_widget ().override_font (Pango.FontDescription.from_string ('8') )
    tvc.get_widget ().show_all ()