【问题标题】:Is it possible to fill upper left cell in wx.grid.Grid?是否可以在 wx.grid.Grid 中填充左上角单元格?
【发布时间】:2012-01-06 19:19:52
【问题描述】:

这个单元格如何(到行标签,从左到列标签) 可以填文字还是图片?

【问题讨论】:

    标签: grid wxpython


    【解决方案1】:

    wxPython 演示中有一个使用 GridLabelRenderer 的示例。以下是演示中的相关代码:

    class MyCornerLabelRenderer(glr.GridLabelRenderer):
        def __init__(self):
            import images
            self._bmp = images.Smiles.getBitmap()
    
        def Draw(self, grid, dc, rect, rc):
            x = rect.left + (rect.width - self._bmp.GetWidth()) / 2
            y = rect.top + (rect.height - self._bmp.GetHeight()) / 2
            dc.DrawBitmap(self._bmp, x, y, True)
    

    然后你通过这样做来调用它:

    myGrid.SetCornerLabelRenderer(MyCornerLabelRenderer())

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-04
      • 2012-08-22
      • 1970-01-01
      • 2013-08-09
      • 2013-05-10
      • 1970-01-01
      • 1970-01-01
      • 2023-02-07
      相关资源
      最近更新 更多