[pygtk] Problem with RadioButton: BACKGROUND COLOR SETTING IGNORED?
Darren Enns
darethehair at gmail.com
Fri Oct 10 05:50:53 WST 2008
Frédéric wrote:
> On jeudi 09 octobre 2008, Darren Enns wrote:
>
>
>> Hello!
>>
>> My normal 'Button' buttons (and now 'ToggleButtons') honor my background
>> color requests just fine (i.e. gtk.STATE_NORMAL, gtk.STATE_ACTIVE,
>> gtk.STATE_PRELIGHT), but now that I have finally learned how to use
>> 'RadioButton' buttons in my code, the background color setting is being
>> ignored! Am I going crazy? All of my other buttons are set
>> intentionally to a solid 'black' background, and the 'RadioButton'
>> buttons stand out since they have a light gray background.
>>
>> I thought I would also try gtk.STATE_INSENSITIVE and gtk.STATE_SELECTED,
>> but those don't (apparently) make any difference either.
>>
>> Can anyone shed light on what I may be missing?
>>
>
> What method do you use to set the background ? modify_bg() ? Also try to
> use modify_base(). See:
>
> http://faq.pygtk.org/index.py?req=show&file=faq04.016.htp
>
>
Thanks for responding! Actually, I ran across the obscure page that you
mentioned a few minutes after posting my question. The technique
described at the *bottom* of the page is a step in the right direction
(despite how convoluted it is). It *does* allow me to set the
background color of the RadioButton:
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("gray"))
However, it does NOT seem to allow me to sent the foreground (text
label) color, which appears to default to 'black'. So, my desire to
have a black background with non-black text is thwarted. Strangely, the
'old' technique that I was using can set the foreground color of
RadioButtons, but not background colors:
button_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("red"))
I would imagine that *somebody* out there has written PyGTK apps with
RadioButtons, and opted not to use the default colors?
Dare
Dare
More information about the pygtk
mailing list