Hi,
I'm working with wx.grid.Grid and custom column headers using wx.lib.mixins.gridlabelrenderer.GridLabelRenderer. I am trying to create a black background with white foreground text column header.
Unfortunately, while the background color works fine, the foreground color is always black, not the selected color.
The code example is based off of the demo for GridLabelRenderer with minor mods.
import wx
import wx.grid as gridLib
import wx.lib.mixins.gridlabelrenderer as glr
class labelGridRenderer(glr.GridLabelRenderer):
def __init__(self):
self._bgcolor = "#000000"
self._fgcolor = wx.Colour(255, 255, 255)
def Draw(self, grid, dc, rect, col):
dc.SetBrush(wx.Brush(self._bgcolor))
dc.SetPen(wx.TRANSPARENT_PEN)
dc.DrawRectangle(rect)
hAlign, vAlign = grid.GetColLabelAlignment()
text = grid.GetColLabelValue(col)
self.DrawBorder(grid, dc, rect)
dc.SetTextForeground(self._fgcolor)
self.DrawText(grid, dc, rect, text, hAlign, vAlign)
What am I missing?