GTK + CSS的一个按钮 [英] GTK+ CSS for one button

查看:668
本文介绍了GTK + CSS的一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为GTK +中的一个按钮设置颜色

  GtkButton button8 {
border-radius:20;
border-width:1 1 1 1;
字体:Sans 16;
颜色:黑色;
background-image:-gtk-gradient(线性,
左上角,
左下角,
颜色停止(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让它只影响一个按钮?

解决方案

gtk_widget_set_name(widget,fooname); 或在glade中做同样的事情:









然后使用类似于

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

请参阅 https://developer.gnome.org/gtk3/stable/GtkCssProvider.html


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?

解决方案

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

这篇关于GTK + CSS的一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆