Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22031

gtk3 change button bg color

$
0
0

Today I start programming in GTK3, and I have a problem. I can't change the button background color, I want to change it after a click on the button. Here is my code:

void pushButton( GtkWidget* button )
{
    gtk_button_set_label( GTK_BUTTON( button ), "new_text" );
    GdkRGBA color = {.0, .0, .0, 1.0};
    gtk_widget_override_background_color ( button, GTK_STATE_NORMAL, &color );
}

gtk_button_set_label() is working well and changes the button label. But the color is still the same (should be black).

gtk_widget_override_background_color has been deprecated since version 3.16 and should not be used in newly-written code. If you wish to change the way a widget renders its background you should use a custom CSS style.


Viewing all articles
Browse latest Browse all 22031

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>