Re: [GObject Introspection] Getting style colors using GTK and Python
- From: John Palmieri <johnp redhat com>
- To: Krzysztof Klinikowski <kkszysiu gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: [GObject Introspection] Getting style colors using GTK and Python
- Date: Sun, 22 Aug 2010 00:24:08 -0400 (EDT)
This is broken - see bug https://bugzilla.gnome.org/show_bug.cgi?id=621258
I have some workarounds in demos directory of pygobject but there is still no ways to get certain attributes. I'll ping Colin again on Monday as he has landed his scanner changes.
----- "Krzysztof Klinikowski" <kkszysiu gmail com> wrote:
> Hello. I need to get colors from used GTK style. Later, using PyGTK I
> do things like:
>
> def get_theme_colors(w = gtk.Window()):
> w.realize()
> style = w.get_style()
> output = {}
>
> for i in ["base", "text", "fg", "bg"]:
> c = getattr(style, i)[gtk.STATE_NORMAL]
> output[i] = Color.from_gtk_color(c)
> c = getattr(style, i)[gtk.STATE_SELECTED]
> output["%s_selected" % i] = Color.from_gtk_color(c)
>
> return output
>
> Now im trying to do using PyGI:
>
> def get_theme_colors(w = gtk.Window()):
> w.realize()
> style = w.get_style()
> output = {}
>
> for i in ["base", "text", "fg", "bg"]:
> print style.bg
> c = getattr(style, i)[gtk.StateType.NORMAL]
> output[i] = Color.from_gtk_color(c).hex
> c = getattr(style, i)[gtk.StateType.SELECTED]
> output["%s_selected" % i] = Color.from_gtk_color(c).hex
>
> return output
>
> But something like style.bg always prits me:
>
> Segmentation fault (core dumped)
>
> Question is why? Should I do that in different way? I have no idea.
> Could anyone help me?
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
--
--
John (J5) Palmieri
Software Engineer
Red Hat, Inc.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]