[pygtk] [GTK3] get background color

2013-01-29 Thread Yann Leboulanger
Hi, I'm trying to get the default / current background color of a textview. The code I do it: context = tv.get_style_context() color = context.get_background_color(Gtk.StateFlags.NORMAL) But that returns a fully transparent color (0,0,0,0) If I first set a custom color with

Re: [pygtk] [GTK3] get background color

2013-01-29 Thread Niklas Koep
Sounds like you're trying to retrieve the default colors before the widget has been realized. Consider this (mind you this uses pygtk): #!/usr/bin/env python import gtk def main(): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.connect(delete-event, lambda *x: gtk.main_quit()) tv

Re: [pygtk] [GTK3] get background color

2013-01-29 Thread Yann Leboulanger
On 01/29/2013 02:35 PM, Niklas Koep wrote: Sounds like you're trying to retrieve the default colors before the widget has been realized. Consider this (mind you this uses pygtk): No, this is done AFTER the widget is realized. It's done in a textbiffer 'changed' callback, a long time (several