how to set a specific css class to a widget in gtk3? (c)

前端 未结 1 611
无人共我
无人共我 2020-12-09 04:35

I\'m trying css in gtk3 and I don\'t understand how to use specific class.

C code:

provider = gtk_css_provider_new();
display = gdk_display_get_defa         


        
相关标签:
1条回答
  • 2020-12-09 05:04

    I solved in this way:

    GtkStyleContext *context;
    enter_button = gtk_button_new_with_label("Print");
    context = gtk_widget_get_style_context(enter_button);
    gtk_style_context_add_class(context,"enter_button");
    

    CSS:

    .enter_button{
        background: #669999;
        text-shadow: 1px 1px 5px black;
        border-radius: 3px;
        box-shadow: 0px 0px 5px black;
    }
    

    For further informations look up here : GtkStyleContext examples

    0 讨论(0)
提交回复
热议问题