python - SetTextColour doesn't work while SetBackgroundColour works -
i have grid in wxpython
, i'm itarating on rows , want rows qualified condition colored in red.
when i'm doing:
attr = gridlib.gridcellattr() attr.setbackgroundcolour('#ff0000') grid.setrowattr(i, attr)
it works , row gets red background... if do:
attr = gridlib.gridcellattr() attr.settextcolour('#ff0000') grid.setrowattr(i, attr)
it doesn't work. nothing happen.
i
row index.
i want text red not background.
why doesn't work?
the following minimal example works me set colour of text in row red,
import wx import wx.grid gridlib class myform(wx.frame): def __init__(self): wx.frame.__init__(self, parent=none, title="grid") panel = wx.panel(self) self.grid = gridlib.grid(panel) self.grid.creategrid(3, 3) sizer = wx.boxsizer(wx.vertical) sizer.add(self.grid, 1, wx.expand) panel.setsizer(sizer) def set_row_colour(self, row): attr = gridlib.gridcellattr() attr.settextcolour('#ff0000') self.grid.setrowattr(row, attr) if __name__ == "__main__": app = wx.app(false) form = myform() form.set_row_colour(2) frame = form.show() app.mainloop()
if isn't working you, may difference in wx (i'm using 2.8.12.1)?
Comments
Post a Comment