Re: [GObject Introspection] Getting style colors using GTK and Python



I talked to Colin.  Current plans are that PyGI will only be fully supported on Gtk3 where Gdk style functionality is going away.  See http://blogs.gnome.org/carlosg/2010/08/23/css-like-styling-for-gtk/ for an idea of where the styling code is headed.  Supporting arbitrary C structs won't be fixed and there are plans to prevent access to these potential segfault prone constructs.
 
----- "John Palmieri" <johnp redhat com> wrote:

> 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.

-- 
--
John (J5) Palmieri
Software Engineer
Red Hat, Inc.


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