I want to have certain rows selected color be red instead of the standard color (blue on windows) so that I can indicate status. Anyone know if this is possible in wxPython?
In your class that you derive from wx.ListCtrl, take a look at overriding
def OnGetItemAttr(self, item):
return self.normalAttr[item % 2]
#
Where the item attributes are initialized ahead of time using:
self.normalAttr = []
self.normalAttr.append(wx.ListItemAttr())
grayAttr = wx.ListItemAttr()
grayAttr.SetBackgroundColour(lightGray)
self.normalAttr.append(grayAttr)
So in this case, I'm alternating background colors between the default, and a light Gray attribute.
This function is called for each row as its painted, so you can use it to indicate all sorts of status. If row is selected should be an easy case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With