如何在GTK +中为一个按钮设置颜色
GtkButton button8 {
border-radius: 20;
border-width: 1 1 1 1;
font: Sans 16;
color: black;
background-image: -gtk-gradient (linear,
left top,
left bottom,
color-stop(0.0,rgba(34,97,170,1)),
color-stop(0.50,rgba(56,145,218,1)),
color-stop(0.51,rgba(34,131,216,1)),
color-stop(1.00,rgba(134,191,234,1)));
}
此css更改了glade文件中al按钮的颜色。我应该如何更改css以便它只影响一个按钮?
答案 0 :(得分:5)
gtk_widget_set_name (widget, "fooname");
或在林间空地做同样的事情:
GtkButton#fooname {
border-radius: 20;
...
}
请参阅https://developer.gnome.org/gtk3/stable/GtkCssProvider.html