2013-03-13 81 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