Hello Robin and all,
A couple of times, very unreproducibly, I have gotten the following error in two unrelated grids:
21-01-03 17:18:51 ERROR [wx.lib.mixins.gridlabelrenderer]: An unexpected error occurred in wx.lib.mixins.gridlabelrenderer. Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/wx/lib/mixins/gridlabelrenderer.py", line 121, in _onPaintColLabels dc = wx.PaintDC(window) TypeError: PaintDC(): argument 1 has unexpected type 'SizerItem'
Both times this has happenend, the error appears every time the grid tries to repaint its column labels and it won’t go away until I restart the application.
I have observed the error in two different grids that use the
GridWithLabelRenderersMixin as in
class MyGrid(wx.grid.Grid, wx.lib.mixins.gridlabelrenderer.GridWithLabelRenderersMixin): ...
Then inits of both grids follow the recommended initialization:
def __init__(self, *args, **kwargs): wx.grid.Grid.__init__(self, *args, **kwargs) wx.lib.mixins.gridlabelrenderer.GridWithLabelRenderersMixin.__init__(self) ...
My current hypothesis is that when initializing the mixing class, concretely line 30 of
self.GetGridColLabelWindow() returns (from wxWidgets) the sizer item that contains the grid rather than the grid subwindow, but this seems farfetched and I don’t know what else to look for.
I don’t think this has to do with my specific code because the two times I have observed this were in two different panels containing two different grids. I run this code frequently and it usually runs just fine. Unfortunately, neither of the two times where I have observed this happened in a computer where I could attach a debugger to the process.
Both computers were debian linux running a self-compiled, relatively recent version (less than 30days old) version of wxPython. I wonder if this might be a wxWidgets issue but I thought I would ask here since I experience the issue only through the pure-python mixin class.
Has anyone experienced anything similar?
Thank you. Best regards,