Python 高亮显示wxgrid行

Python 高亮显示wxgrid行,python,model-view-controller,grid,wxpython,Python,Model View Controller,Grid,Wxpython,我在寻找一些解决办法,但我没有接受 我想在日期结束时突出显示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

我在寻找一些解决办法,但我没有接受

我想在日期结束时突出显示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

def装载网格费用(自身、费用):
i、j、k的票价:
self.grid\u fare.SetCellValue(计数行,0,str(i.fare\u id))
self.grid\u fare.SetCellValue(count\u rows,1,str(j.service\u name).encode('utf8'))
self.grid\u fare.SetCellValue(计数行,2,str(k.vehicle\u type\u name)。编码('utf8'))
self.grid\u fare.SetCellValue(计数行,3,str(i.fare\u cash))
self.grid\u fare.SetCellValue(计数行,4,str(i.fare\u startdate.strftime(“%d/%m/%Y”))
self.grid\u fare.SetCellValue(count\u rows,5,str(i.fare\u enddate.strftime(“%d/%m/%Y”))
计数行数+=1

你需要看看wxPython的演示,它可以从wxPython网站下载。其中有几个示例演示如何更改单元格、行或列的颜色。在演示中,它显示您需要创建GridCellAttr()对象并执行以下操作:

attr = wx.grid.Grid.GridCellAttr()
attr.SetBackgroundColour(wx.RED)
self.SetRowAttr(5, attr)

其中“self”指的是wx.grid.grid。上面的代码将第6行的背景色设置为红色。

您需要查看wxPython演示,该演示可从wxPython网站下载。其中有几个示例演示如何更改单元格、行或列的颜色。在演示中,它显示您需要创建GridCellAttr()对象并执行以下操作:

attr = wx.grid.Grid.GridCellAttr()
attr.SetBackgroundColour(wx.RED)
self.SetRowAttr(5, attr)

其中“self”指的是wx.grid.grid。上面的代码会将第6行的背景颜色设置为红色。

谢谢,我在演示文件夹中搜索了一些代码并找到了解决方案谢谢,我在演示文件夹中搜索了一些代码并找到了解决方案