我正在使用wxPython网格,但是我不能设置它的背景色(没有填充单元格的网格部分)。我试过了网格背景颜色,但运气不佳;显示的背景色始终是windows的默认系统颜色。在
在版本.wx()—>2.8.10.1(msw unicode)
在系统版本->;2.5(r25:519089月19日,09:52:17)[MSCV.1310 32位(Intel)]
O/S版本->;windowsxpsp3,但是我尝试了一个基于Ubuntu的Python livecd,结果是一样的。在import wx
import wx.grid
class TestFrame (wx.Frame):
def __init__ (self):
wx.Frame.__init__ (self, None, title="Grid Table", size=(640,480))
grid = wx.grid.Grid(self, size=(300,300))
grid.CreateGrid(2,2)
grid.SetCellValue(0,0,"1")
color = (100,100,255)
attr = self.cellAttr = wx.grid.GridCellAttr()
attr.SetBackgroundColour(color)
# for row, col in
for row in xrange(2):
for col in xrange(2):
grid.SetAttr(row, col, attr)
grid.SetBackgroundColour(color) # <<< This don't work!
app = wx.PySimpleApp()
frame = TestFrame()
frame.Show()
app.MainLoop()