I'm doing this in preparation to reload a grid with fresh data:
# Make sure the grid is empty and clean
self.ClearGrid()
r = self.GetNumberRows()
if r > 0: self.DeleteRows(0, r)
Seems straightforward, but I get this:
PyAssertionError: C++ assertion "m_refData->m_count > 0" failed at ..\..\src\common\object.cpp(321) in wxObject::UnRef(): invalid ref data count
At this line of code in grid.py:
def DeleteRows(*args, **kwargs):
"""DeleteRows(self, int pos=0, int numRows=1, bool updateLabels=True) -> bool"""
return _grid.Grid_DeleteRows(*args, **kwargs)
Am I doing something wrong?
Probably not. It sounds more like a bug somewhere in the grid classes. Please create a small sample that shows the problem.
Thanks. Not sure I am able to do that. To my knowledge I've seen this error exactly once. But it caused a solid crash and that's what prompted my message. I'll keep trying to reproduce it.