grid attributes and GetAttr

m.prosperi at libero.it wrote:

hello ML, I'm using wx.grid to view a database table (50k records). I'm setting attributes to columns and also for some rows (if a field of a record has a particular value I change the colour of the row values). I fetch the records from the
database as needed and I set cell attributes with wx.grid.PyTableBase.GetAttr because of the different
combinations of col and row attributes. It all works fine except when I click on a grid column label. In this
case the column is selected, GetAttr is called for all the 50000 cells of the column (seems to be the default behaviour of
wxpython) and the user has to wait too many seconds for the column to be selected. How can I prevent GetAttr from being called
if a cell is not visible? Now I'm doing as follows but is not the solution (it takes too much time, it would be better not to call
GetAttr at all for the hidden cells)

The only reason I can think of that would cause it to fetch the
attributes for all cells in the column is if you've done something like
turn on autosizing, or explicitly call the autosize methods. Then it
will need to fetch the attributes to get the font to use for measuring
cell content.

If you're not doing anything like that then please make a small runnable
sample that shows the problem so we can see exactly what you are doing.

--
Robin Dunn
Software Craftsman

I'm using wxpy 2.8.7.1 but I've discovered that the issue has been solved in 2.8.9.1
To verify it is enough to put a print row or self.log.write.. in GetAttr in GridHugeTable.py of the demo and select a column of the grid.

Marco