to this...
for word in "These are toggle buttons".split():
b = wx.ToggleButton(panel, -1, word)
b.SetBackgroundColour(wx.Colour(255,0,0))
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggle, b)
buttons.Add(b, flag=wx.ALL, border=5)
Only the border edge of the toggle button changes to a red color, and
not the background of the text area background color (which remains,
on my Windows 7 box, blue).
Using wxPython 2.9.1.1 and Python 2.7 on a Windows 7 box.
Is this expected behavior or is it a bug?
I'd use wx.lib.buttons.GenToggleButton, except IT has problems with
multi-line text.
troubles, troubles...
Chris.
Expected. Since XP the native Windows button draws fixed textures over
the window's background, so I guess you could say that the entire button
is in the foreground. Last I checked the native widget doesn't pay any
attention to the foreground color either.
For wxButton wx puts the button into owner-drawn mode when the colors
are set, and then wx draws the button itself and doesn't let the native
button draw anything. I guess that same thing was not done with
wx.ToggleButton,
>
> I'd use wx.lib.buttons.GenToggleButton, except IT has problems with
> multi-line text.
You can implement a DrawLabel method in a derived class and then draw
the contents of the button however you like if the default doesn't meet
your needs.
--
Robin Dunn
Software Craftsman
http://wxPython.org