ToggleButton Color Change



I have been successful on Fedora 11 changing a ToggleButton's background color. But the same code on Windows XP does nothing. Is more needed on XP??

My versions of software are:

Fedora 11, Glade 3.6.1, PyGTK 2.14.1, GTK 2.16.1
Windows XP, Glade 3.6.7, PyGTK 2.12.1, GTK 2.16.4)

The code that works on Fedora 11 and not on XP looks like this for the toggle button handler:

    def on_togglebutton_toggled(self, widget, data="">
        map   = widget.get_colormap()
        color_off = map.alloc_color("red")
        color_on  = map.alloc_color("green")            
        
        labeltxt = widget.get_label()
        if labeltxt == '1':
            widget.set_label('0')
            widget.modify_bg(gtk.STATE_NORMAL, color_off)
        else:
            widget.set_label('1')
            widget.modify_bg(gtk.STATE_ACTIVE, color_on)

I have read the various PyGTK FAQ articles and tried copying the button's style, modifying it, and doing a set style; as well as using an enventbox, which only served to color the eventbox around the button, not the button itself.

So is this something that cannot be done under XP? Or requires a completely different approach?

Thanks
E.R. Uber




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