我正在寻找一些解决方案,但我没有得到它。
当日期结束时,我想突出显示wx.Grid中的行。
有没有什么函数可以做到这一点呢?
<i>
def load_grid_fare (self, fares):
for i, j, k in fares :
self.grid_fare.SetCellValue(count_rows,0,str(i.fare_id))
self.grid_fare.SetCellValue(count_rows,1,str(j.service_name).encode('utf8'))
self.grid_fare.SetCellValue(count_rows,2,str(k.vehicle_type_name).encode('utf8'))
self.grid_fare.SetCellValue(count_rows,3,str(i.fare_cash))
self.grid_fare.SetCellValue(count_rows,4,str(i.fare_startdate.strftime("%d/%m/%Y")))
self.grid_fare.SetCellValue(count_rows,5,str(i.fare_enddate.strftime("%d/%m/%Y")))
count_rows += 1
发布于 2013-03-14 22:13:53
您需要查看可以从wxPython网站下载的wxPython演示。其中有几个示例展示了如何更改单元格、行或列的颜色。在演示中,它显示了您需要创建一个GridCellAttr()对象并执行以下操作:
attr = wx.grid.Grid.GridCellAttr()
attr.SetBackgroundColour(wx.RED)
self.SetRowAttr(5, attr)其中"self“指的是wx.grid.Grid。上面的代码将第6行的背景颜色设置为红色。
https://stackoverflow.com/questions/15395432
复制相似问题