Web lists-archives.com

Re: Treeviews: changing the color of column headers

Thanks for your responses. However:

1.- In the sample program that I provided, a custom label is created and attached with set_widget to the treeview column in routine "set_header". 2.- I am trying to change the background of the treeview column header, no the label text style. 3.- I followed the recommendations given in the thread messages of 2003-11-19 named "GTK TreeView Column Header Colors" in the gtk-list archives in Nov. 2003. The post was initially made by Mike Dailey and then T. Evans responded with a solution:
- set widget (with the label)
- once the label is shown and realized:
- get_parent three times to get the button
- then modify_bg for this button
The above is implemented in the sample program in routines "set_color_header" and "set_color".

They reported that this approach worked but not in my case. What is wrong in the sample program? Unfortunately I couldn't guess their mail addresses to consult with the people involved in 2003.

I am using GTK2, porting to GTK3 is out of scope for the moment. May be that GTK2 do not support at all changing the column header color but I saw some examples in pyton doing this.

El 14/06/2015 a las 1:32, Daniel Kasak escribió:
I've done this in Gtk2. I don't have my laptop and old code handy
right now, but from memory:

- create a label
- set_markup() on the label, and set your colour(s) in there
- use TreeViewColumn.set_widget() to override the default label

If you can't get it working, post again and I'll go and dig out the
old ( perl ) code that I used.


On Sun, Jun 14, 2015 at 7:55 AM, Stefan Salewski <mail@xxxxxxxxxxxx> wrote:
On Sat, 2015-06-13 at 20:43 +0200, Stefan Salewski wrote:
On Tue, 2015-06-09 at 08:54 +0200, Juan L. Freniche wrote:
I am trying to change the color of the column headers of a treeview,
with no sucess at all.
It is funny that currently many people try to change default colors of
GTK widgets. Of course generally that is not a good idea -- common sense
is to give users their default styles. Of course, for special
applications that may be OK. For tree view headers, I can remember that
I tried to chance something style related, and it worked after I added a
custom label widget as header text. See


Try using a custom widget for the header using
Sorry, have not been able to get it working with GTK2. I tried to put a
label in a column header and change the color of the label with
gtk_widget_modify_bg(label, GTK_STATE_NORMAL, &color). But it seems to
have no effect. Maybe it would work for GTK3, there we have

gtk-list mailing list

gtk-list mailing list