[wxPython-users] TextCtrl.SetBackgroundColour() not working?

Robin Dunn robin at alldunn.com
Mon Jun 4 09:55:52 PDT 2007


Ed Leafe wrote:
>     I've noticed that SetBackgroundColour() doesn't seem to have any 
> effect on a TextCtrl. In my app, if I want to flag a bad value with a 
> red background, I use the code:
> 
> txt.SetBackgroundColour((255, 0, 0))
> txt.Refresh()
> 
> ... but nothing changes. Is changing the background not supported for 
> text controls?

It depends on the platform and possibly on the active theme.  For 
example some GTK themes do not allow the color to be changed for some 
widgets, and I think that single line textctrls can't have background 
color changes on OSX.

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





More information about the wxpython-users mailing list