2013-03-13 69 views
2

我一直在寻找一些解决方案,但我没有得到它。高亮行wxgrid

我想强调的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 

回答

2

你需要看一看在wxPython的演示,可以从wxPython的网站上下载。其中有几个示例显示如何更改单元格,行或列颜色。在演示中,它表明你需要创建一个GridCellAttr()对象,并做到以下几点:

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

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

+0

谢谢你,我搜索demo文件夹中的一些代码,并发现与解决方案 – user2167145 2013-03-15 20:32:04