GTK+ CSS for one button

戏子无情 提交于 2019-12-08 03:20:56

问题


How to set color for one button in 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)));
}

This css changes the color of al buttons in glade file.How should i change the css so that it affects only one button?


回答1:


gtk_widget_set_name (widget, "fooname"); or do the same in glade:



then use something like

GtkButton#fooname {
     border-radius: 20;
     ...
}

See https://developer.gnome.org/gtk3/stable/GtkCssProvider.html



来源:https://stackoverflow.com/questions/22012039/gtk-css-for-one-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!