簡體   English   中英

是否可以在wx.grid.Grid中填充左上方的單元格?

[英]Is it possible to fill upper left cell in wx.grid.Grid?

如何用文本或圖像填充此單元格(最多行標簽,最左列標簽)?

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())

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM