Re: [GTK3] get background color of a textview



On 31/07/13 22:09, Yann Leboulanger wrote:
On 07/31/2013 02:23 PM, Yann Leboulanger wrote:
Hi,

I'm trying to get the background color of a textview. I use python /
pygobject, but I don't think it's related to the language.

I tried doing that:

context = textview.get_style_context()
state = Gtk.StateFlags.NORMAL
color = context.get_background_color(state)

I tried all possible states, but none returns the correct background
color (white in my case)

I precise that textview is already realized, this code is done in a
callback.

Any idea how to get it?

Thanks in advance,

Here is a very simple test script that shows the problem. For me it
always prints:
<Gdk.Color(red=0.000000, green=0.000000, blue=0.000000, alpha=0.000000)>


I have the same problem, but with a hand-made widget.

I see my theme has the following CSS:

@define-color selected_bg_color #f07746;
@define-color selected_fg_color #ffffff;

*:selected,
*:selected:focused {
    background-color: alpha (@selected_bg_color, 0.9);

    color: @selected_fg_color;
}

So my question here is: does "*" apply also to elements that don't have any class at all? If the answer is yes, I'm really lost on what the culprit of my problem might be...




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]