wx.StaticText problem

Petar Dimitrijevic wrote:

Hi guys,

I'm having problems with the wx.StaticText control. I want to create one with a border around it and to change it's background color.
So I use the following code:

lbl = wx.StaticText(self, -1, "Label 1", size=wx.Size(200, 200), style=wx.BORDER_SIMPLE)
lbl.SetBackgroundColour('red')

On wxGTK the native static text widget is not a real window, it is simply drawn on its parent. So some things like background colors are not possible to support in this mode. There is a generic static text widget in the library you can use instead, and since it has a real window associated with it then all the things that don't work with the native one do work. See wx.lib.stattext. You can try it out in the demo by changing the USE_GENERIC value at the top of the module.

ยทยทยท

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