pygtk2 and colors

bkimstunnaboss at gmail.com bkimstunnaboss at gmail.com
Tue Jul 7 10:47:12 EDT 2015


Hi Nick,
Doing colors with pygtk2 is a real pain...
But to change the foreground, what you wanna do is to get a copy of the style of the widget, set the color values on it, and then set it back as the style.
Like so...

    color = gtk.gdk.color_parse('#ac0102')
    style = self.get_style().copy()
    style.fg[gtk.STATE_NORMAL] = color
    style.fg[gtk.STATE_PRELIGHT] = color
    self.set_style(style)

Very unpythonic imo...



More information about the Python-list mailing list