Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure how to get it from gtk+-2.0, unless your using a pure gtk+-2.0 environment, in which case I think the old GtkStyle methods work. for example, assuming your not running a Gtk-3.0 environment like gnome-shell</p> <pre><code>import gi # make sure you use gtk+-2.0 gi.require_version('Gtk', '2.0') from gi.repository import Gtk window = Gtk.Window() ... style = window.get_style() print style.lookup_color('fg_color') </code></pre> <p>I think that should still work under a gtk+-2.0 environment. I don't know for sure as my system is running gnome-shell, and can't easily try this out.</p> <p>However this method has been deprecated and replaced by GtkStyleContext. If I use the above code in a gtk+-3.0 environment like gnome-shell it will run, but does not give me the information I'm after. What I get is </p> <pre><code>(False, &lt;Gdk.Color(red=0, green=0, blue=0)&gt;) </code></pre> <hr> <h2>EDIT: Looking back at this, I think the above is still giving the correct info. The colour for fg_color is not found, as indicated by the first entry in the tuple result, which is False. Also the window must be visible for the colours to be found.</h2> <p>If I want colour information I want to use the new GtkStyleContext, for example</p> <pre><code>import gi # make sure you use gtk+-3.0 gi.require_version('Gtk', '3.0') from gi.repository import Gtk window = Gtk.Window() ... style_context = window.get_style_context() print style_context.lookup_color('fg_color') </code></pre> <p>this will give me some real data, which is telling me the 'fg_color' has been found, due to the first entry in the tuple is True.</p> <pre><code>(True, &lt;Gdk.Color(red=0.000000, green=0.000000, blue=0.000000, alpha=1.000000)&gt;) </code></pre> <p>I hope this answers your question.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload