FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 19.19 | Next Entry >>

19.19. How can I change the background color of the IconView widget?

set the base color of the IconView widget style for diverse states of the widget. Here is an example demonstrating how to set the background of an IconView widget to the same color as the parent ScrolledWindow widget:

    sw = gtk.ScrolledWindow()
    iconview = gtk.IconView()
    style = iconview.get_style().copy()
    style_sw = scrolled_window.get_style()
    for state in (gtk.STATE_NORMAL, gtk.STATE_PRELIGHT,gtk.STATE_ACTIVE):
        style.base[state] = style_sw.bg[gtk.STATE_NORMAL]
    iconview.set_style(style)

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org