wxpython grid设置字体颜色_如何设置wxPython网格背景颜色?

我正在使用wxPython网格,但是我不能设置它的背景色(没有填充单元格的网格部分)。我试过了网格背景颜色,但运气不佳;显示的背景色始终是windows的默认系统颜色。在

在版本.wx()—>2.8.10.1(msw unicode)

在系统版本->2.5(r25:519082006年9月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()

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值