SetBackgroundColour() not affecting wx.SpinCtrl?

Dear List,

Just noticed something odd...

I can't set the background colour of a SpinCtrl on win32. Haven't checked on Linux.

        #This is working...
        self.sizeCtrl = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY)
        self.sizeCtrl.SetBackgroundColour(wx.Colour(255, 200, 200))

        #This is not working!
        self.posCtrl = wx.SpinCtrl(panel, -1,"", style=wx.TE_READONLY)
        self.posCtrl.SetBackgroundColour(wx.Colour(200, 255, 200))

(see example attached).

Any idea why? I guess I can always use a TextCtrl + SpinButton if all else fails...

Cheers,
Egor

···

_________________________________________________________________
The next generation of Hotmail is here! http://www.newhotmail.co.uk

egor zindy wrote:

Dear List,

Just noticed something odd...

I can't set the background colour of a SpinCtrl on win32. Haven't checked on Linux.

       #This is working...
       self.sizeCtrl = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY)
       self.sizeCtrl.SetBackgroundColour(wx.Colour(255, 200, 200))

       #This is not working!
       self.posCtrl = wx.SpinCtrl(panel, -1,"", style=wx.TE_READONLY)
       self.posCtrl.SetBackgroundColour(wx.Colour(200, 255, 200))

(see example attached).

Any idea why?

The wx.SpinCtrl is a composite control, so the background is probably just being set for the main widget, not the children.

I guess I can always use a TextCtrl + SpinButton if all else fails...

Yep, that is probably what you'll need to do.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!