Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
Thanks! In some containers we can't change color of label? I have labels inside GtkLayout, and don't change color with Css but other labels out of this layout change. Why don't works? I do this dynamically but don't works too: GtkCssProvider *css_provider = gtk_css_provider_new();

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Richard Shann
From: R?ben Rodrigues > On 16-03-2017 11:20, Tilo Villwock wrote: > > Am Donnerstag, den 16.03.2017, 09:55 + schrieb R?ben Rodrigues: > >> Hi, > >> > >> THanks. This is dynamically? I need in c language if possible :S > > Dynamic version: > > > > ... > > > > static

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
You are right. I don't know why don't works before, because I had already tested and doesn't work... BU apparently now works with gdk_screen_get_default(); THanks for your help. On 16-03-2017 14:07, Tilo Villwock wrote: > Am Donnerstag, den 16.03.2017, 13:50 + schrieb Rúben Rodrigues: >>

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
OK, now works: if(css_provider == NULL){ css_provider = gtk_css_provider_new(); apply_css(gtk_builder_get_object(builder,"window_Main"),css_provider); g_object_unref(css_provider); } gtk_css_provider_load_from_data (css_provider,"#label_Sensors { color: red;

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Tilo Villwock
Am Donnerstag, den 16.03.2017, 13:50 + schrieb Rúben Rodrigues: > I get this error: > > gtk-CRITICAL **: gtk_style_context_add_provider_for_screen: > assertion  > 'GDK_IS_SCREEN (screen)' failed > > COde:  > gtk_style_context_add_provider_for_screen(gtk_widget_get_style_contex >

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
I get this error: gtk-CRITICAL **: gtk_style_context_add_provider_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed COde: gtk_style_context_add_provider_for_screen(gtk_widget_get_style_context(GTK_WIDGET(gtk_builder_get_object(builder,"window_Main"))), GTK_STYLE_PROVIDER

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
No! This is the ID: https://ibin.co/3FlPSBGuokBB.png and this is the widget name https://ibin.co/3FlPnPaDN7Zl.png that i used in css provider. This is not the problem because in start of the program i change the label to other color to understand if css provider is working. And works, but when

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Emmanuele Bassi
You keep using an id in the selector, but you never show how you set the id on the widget. I suspect you think the buildable ID you use with GtkBuilder is also the ID used when theming — which is definitely not the case. You will need gtk_widget_set_name(), instead. Of course, that comes with its

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
I provide my code in previous emails. This is my code now: if(css_provider == NULL){ css_provider = gtk_css_provider_new(); gtk_style_context_add_provider (gtk_widget_get_style_context(GTK_WIDGET(gtk_builder_get_object(builder,"window_Main"))),

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
Hi, This is what i have, and don't works... On 16-03-2017 11:20, Tilo Villwock wrote: > Am Donnerstag, den 16.03.2017, 09:55 + schrieb Rúben Rodrigues: >> Hi, >> >> THanks. This is dynamically? I need in c language if possible :S > Dynamic version: > > ... > > static GtkCssProvider*

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Tilo Villwock
Am Donnerstag, den 16.03.2017, 09:55 + schrieb Rúben Rodrigues: > Hi, > > THanks. This is dynamically? I need in c language if possible :S Dynamic version: ... static GtkCssProvider* provider = NULL; static void set_label_color(GtkWidget* label, const char* color) { const char* format

How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
Please help me. I don't see nothing with web to change label color dynamically but i need this urgent THanks again! On 16-03-2017 09:55, Rúben Rodrigues wrote: > Hi, > > THanks. This is dynamically? I need in c language if possible :S > > Thanks > > > On 16-03-2017 07:29, Stefan Salewski

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Stefan Salewski
On Thu, 2017-03-16 at 09:55 +, Rúben Rodrigues wrote: > Hi, > > THanks. This is dynamically? I need in c language if possible :S > > Thanks Yes. The example https://github.com/ngtk3/nim-gtk3/blob/master/test/colors.nim is dynamically, I used it to generate some color schemes. Entered

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Rúben Rodrigues
Hi, THanks. This is dynamically? I need in c language if possible :S Thanks On 16-03-2017 07:29, Stefan Salewski wrote: > On Wed, 2017-03-15 at 15:11 +, 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

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Stefan Salewski
On Wed, 2017-03-15 at 15:11 +, 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,  > ); > >

How to change GTK+3 label color dynamically

2017-03-15 Thread Rúben Rodrigues
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, ); How can i change the color in Gtk3? Thanks