如何在Gtk + 3中设置背景色GtkBox? [英] how to set background color GtkBox in Gtk+3?

查看:187
本文介绍了如何在Gtk + 3中设置背景色GtkBox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GTK + 3中创建了应用程序,我想更改GtkBox的背景颜色,但是这里不能提供此代码:

I create application in GTK+3 and I Would like to change the background color for GtkBox but can not here this code:

box.modify_bg(Gtk.StateType.NORMAL, color);

推荐答案

GTK + 3的问题" 是您问题的答案.

在基本形式下,您可以使用:

In the basic form, you can use:

box.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(.5,.5,.5,.5))

在这种情况下,颜色将是柔和的灰色,半透明.可能您想在draw信号期间绘制它.

In this case, the color will be a soft grey, half transparent. Probably, you want to paint it during the draw signal.

这篇关于如何在Gtk + 3中设置背景色GtkBox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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