I'm trying to do a very simplistic derivation of gridlib.Grid so that I can have it automatically supply a certain renderer for a *column* instead of for a *cell*. I'm trying to avoid having to set the same renderer on every cell in a column when I know they are all the same within a column. Code snippet(s):
# Derive a class from gridlib.Grid and stub some renderer
# inquiry methods
class MyGrid(gridlib.Grid):
def __init__(self, parent):
gridlib.Grid.__init__(self, parent, -1)
print "Init a MyGrid"
When I then instantiate and fill the grid, I get confirmation that it has initialized newGrid but none of the abbreviated methods above are ever called. Does gridlib.Grid bypass its own internal methods? How does it know what renderer to use on a particular cell?
I'm trying to do a very simplistic derivation of gridlib.Grid so that I can have it automatically supply a certain renderer for a *column* instead of for a *cell*. I'm trying to avoid having to set the same renderer on every cell in a column when I know they are all the same within a column. Code snippet(s):
# Derive a class from gridlib.Grid and stub some renderer
# inquiry methods
class MyGrid(gridlib.Grid):
def __init__(self, parent):
gridlib.Grid.__init__(self, parent, -1)
print "Init a MyGrid"
When I then instantiate and fill the grid, I get confirmation that it has initialized newGrid but none of the abbreviated methods above are ever called. Does gridlib.Grid bypass its own internal methods?
How does it know what renderer to use on a particular cell?
You can either create a wx.grid.GridCellAttr object, set the renderer in that attr and then call theGrid.SetColAttr, or you can do it by using a custom table class that returns the attributes you want from an overridden GetAttr.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!