[wxPython-users] changing font colour

Andrea Gavana andrea.gavana at gmail.com
Thu Sep 13 06:07:13 PDT 2007


Hi Robert,

On 9/10/07, Robert Gravina wrote:
> I'd like a wx.StaticBox to draw it's text in white, rather than
> black. I would assume that I just need to call SetForegroundColour on
> the wx.StaticBox instance, so does anyone know why in this test
> script (pasted and attached) the colour doesn't change?

Uhm, you're referring to wx.StaticBox but you're not actually using
any wx.StaticBox in your code... You have a main wx.BoxSizer sizer in
which you put a wx.StaticText.
Anyway, wx.Colour accepts an rgb tuple/trio input, so you should
correct the line:

label.SetForegroundColour(wx.Colour(wx.WHITE))

with:

label.SetForegroundColour(wx.WHITE)
or:
label.SetForegroundColour(wx.Colour(255, 255, 255))


Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/




More information about the wxpython-users mailing list