Re: How to change GTK+3 label color dynamically



On Wed, 2017-03-15 at 15:11 +0000, Rúben Rodrigues wrote:
Hi,

Now i need to change GtkLabel color dinamically, so i thing that i
can't 
use Css to do this.. I do this in Gtk2:

gtk_widget_modify_fg(GTK_WIDGET(gtk_builder_get_object(builder,"label
")),GTK_STATE_NORMAL, 
&white);

How can i change the color in Gtk3?

 

You can do it with CSS. But it has changed a bit for 3.20. You may
compare this thread:

https://mail.gnome.org/archives/gtk-list/2016-November/msg00006.html

Well, that was not for label widget, but for tooltip. But label widget
should behave similar. And with similar code I once set foreground and
background for button widgets -- I had that working for 3.18, but I
have not yet fixed that for 3.20. (https://github.com/ngtk3/nim-gtk3/bl
ob/master/test/colors.nim)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]