I want to create a platebutton that NEVER changes the color of the
label text. So far I've been trying to
do this with the .SetLabelColour methods, but not only is this getting
messy, it also breaks down under
certain conditions for reasons I can't quite fathom. The sensible
approach is probably to subclass platebutton
and implement the behaviour I want by modifying the default attributes
and/or methods. My question then is where is the most appropriate
place to do this. From what I can see by examining the platebutton
class there are several candidates, and __initcolours seems the most
promising, but before I set off down this path does anyone have any
advice about the best approach?
I want to create a platebutton that NEVER changes the color of the
label text. So far I've been trying to
do this with the .SetLabelColour methods, but not only is this getting
messy, it also breaks down under
certain conditions for reasons I can't quite fathom. The sensible
approach is probably to subclass platebutton
and implement the behaviour I want by modifying the default attributes
and/or methods. My question then is where is the most appropriate
place to do this. From what I can see by examining the platebutton
class there are several candidates, and __initcolours seems the most
promising, but before I set off down this path does anyone have any
advice about the best approach?
Do you have an example of how SetLabelColor ?breaks down"?
If you want to force a label color to stay the same then SetLabelColor
is what you want to call by passing the same color for both
parameters.
myplatebutton.SetLabelColor(wx.BLUE, wx.BLUE)
That will set the regular and the highlight label color to be the same.
You can certainly subclass it and do this in the constructor or
something if you want to simplify it something like this should do it.
Do you have an example of how SetLabelColor ?breaks down"?
I was possibly a little hasty in blaming the platebutton for the
problems I was having; It seems
it was more to do with using wx.NullColor as the highlight colour, and/
or
the fact that the button was also being used as a droptarget.
Implementing
your suggestion has worked well.