wxComboBox backgroundColour

33 views
Skip to first unread message

Ron

unread,
Nov 13, 2009, 11:24:55 AM11/13/09
to wxPython-users

---------------------------------------------------------------
wxPyrts,

Another wxComboBox issue: Has anyone ever tried to set the
background color of this control? When I do, the actual text
background remains white, and a thin border of the desired
color shows up around it. It's almost as if the text is on
a label inside the control, and the label background isn't
adjusted. Is there something I'm missing, or is this just
a bug?

(MSW, Python2.1, wxPython 2.3.3.1)
---------------------------------------------------------------

I can't set the background either after our Red Hat was upgraded.
Using the same wxPython version but now can't set the background of
wxComboBox.

------------------------------
Ron

wxPython version: (2, 8, 6, 0, ' ')
Python version: 2.5.1
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]

Robin Dunn

unread,
Nov 13, 2009, 1:52:08 PM11/13/09
to wxpytho...@googlegroups.com
On 11/13/09 8:24 AM, Ron wrote:
>

> I can't set the background either after our Red Hat was upgraded.
> Using the same wxPython version but now can't set the background of
> wxComboBox.

The new version of the GTK theme probably isn't allowing it. Try using
different themes.

--
Robin Dunn
Software Craftsman
http://wxPython.org

Ron

unread,
Nov 16, 2009, 10:00:32 AM11/16/09
to wxPython-users
I went to System/Preferences/Theme and tried every setting, but the
backgrounds for wxComboBox never changed even though other features of
the GUI did change. Is that what you are talking about?

Thanks,
Ron
----------------------------------------
wxPython version: (2, 8, 6, 0, ' ')
Python version: 2.5.1
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]
-----------------------------------------

Robin Dunn

unread,
Nov 16, 2009, 1:32:45 PM11/16/09
to wxpytho...@googlegroups.com
On 11/16/09 7:00 AM, Ron wrote:
>
>
> On Nov 13, 12:52 pm, Robin Dunn<ro...@alldunn.com> wrote:
>> On 11/13/09 8:24 AM, Ron wrote:
>>
>>
>>
>>> I can't set the background either after our Red Hat was upgraded.
>>> Using the same wxPython version but now can't set the background of
>>> wxComboBox.
>>
>> The new version of the GTK theme probably isn't allowing it. Try using
>> different themes.
>>
>> --
>> Robin Dunn
>> Software Craftsmanhttp://wxPython.org
>
> I went to System/Preferences/Theme and tried every setting, but the
> backgrounds for wxComboBox never changed even though other features of
> the GUI did change. Is that what you are talking about?

Yes.

Ron

unread,
Nov 16, 2009, 3:01:00 PM11/16/09
to wxPython-users
Any other ideas then?

Thanks,
Ron
----------------------------------------
wxPython version: (2, 8, 6, 0, ' ')
Python version: 2.5.1
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]
-----------------------------------------

> Software Craftsmanhttp://wxPython.org- Hide quoted text -
>
> - Show quoted text -

Cody Precord

unread,
Nov 16, 2009, 3:06:40 PM11/16/09
to wxpytho...@googlegroups.com
Hi,

On Mon, Nov 16, 2009 at 2:01 PM, Ron <ronnie.a....@lmco.com> wrote:
>
> Any other ideas then?

Yes, this is a wxWidgets bug (http://trac.wxwidgets.org/ticket/4753)
It appears to have been fixed for 2.9 since gtk will have a native
control implimentation there. However no fix appears to have been
applied to the 2.8 branch.


Cody

Ron

unread,
Nov 16, 2009, 5:16:05 PM11/16/09
to wxPython-users
Thank you very much Cody. Does that mean we have to upgrade to
wxPython 2.9 to fix this? Is there any easy work around? Or one
easier than switching to a textfield and a button?

On Nov 16, 2:06 pm, Cody Precord <codyprec...@gmail.com> wrote:
> Hi,
>

Cody Precord

unread,
Nov 16, 2009, 5:27:03 PM11/16/09
to wxpytho...@googlegroups.com
Hi,

On Mon, Nov 16, 2009 at 4:16 PM, Ron <ronnie.a....@lmco.com> wrote:
>
> Thank you very much Cody. Does that mean we have to upgrade to
> wxPython 2.9 to fix this? Is there any easy work around?  Or one
> easier than switching to a textfield and a button?

I slightly misread your original problem, what I described is in
regards to the themeing issue.

I can't remember for sure at the moment but if the combo box your
using is a composite control under gtk you should be able to iterate
through the list returned by GetChildren() to find the TextCtrl
instance and modify it directly. From your original description of it
only modifying the border around the text control it would lead me to
believe it is a composite control and the SetBackground is probably
only being called on the parent container control and not the TextCtrl
portion.


Cody

Ron

unread,
Nov 16, 2009, 5:47:43 PM11/16/09
to wxPython-users
Thanks,

I'll try the GetChildren().

On Nov 16, 2:06 pm, Cody Precord <codyprec...@gmail.com> wrote:
> Hi,

Ron

unread,
Nov 16, 2009, 6:14:32 PM11/16/09
to wxPython-users
It has no children.
> > Cody- Hide quoted text -

Ross

unread,
Nov 25, 2009, 2:55:16 PM11/25/09
to wxpytho...@googlegroups.com

Hello all,

I'm trying to colour the item text in a wxRadioBox, so that I can
associate the items with some other coloured UI items. I was hoping
for something like

myRadioBox.SetItemForegroundColour(wx.BLUE, 0)

But I guess there isn't such a thing? Any suggestions how I could do
that?
My current guess is that I have to use separate wx.RadioButton's and
change their background colours.

As far as I can see, also, changing Foreground colour doesn't take on
wxRadioBox and only background colour can be changed.

Any hints are appreciated.

Regards,

Ross.
(Platform Mac OS X 10.4, python 2.5.2, wxPython 2.8.10.1)

Steven Sproat

unread,
Nov 25, 2009, 6:03:18 PM11/25/09
to wxpytho...@googlegroups.com
Try changing its font

font = radiobutton.GetFont()
font.SetColour("red")
radiobutton.SetFont(font)

Steven Sproat

unread,
Nov 25, 2009, 6:06:06 PM11/25/09
to wxpytho...@googlegroups.com
Uh, disregard my last message; I didn't realise Fonts don't have a
colour attribute, sorry.

Robin Dunn

unread,
Nov 25, 2009, 7:17:19 PM11/25/09
to wxpytho...@googlegroups.com
On 11/25/09 11:55 AM, Ross wrote:
>

> My current guess is that I have to use separate wx.RadioButton's and
> change their background colours.

Yes.

Reply all
Reply to author
Forward
0 new messages