The documentation for Grid
GetDefaultRenderer (wx.grid.Grid — wxPython Phoenix 4.1.2a1 documentation) indicates that this method Returns a pointer to the current default grid cell renderer.
In python this means that if we call
SetDefaultRenderer with a custom renderer, a subsequent call to
GetDefaultRenderer does not return our python object but some
<wx._grid.GridCellRenderer object at 0x7f57361c5948>.
An attempt to cast this object to its actual python object like:
myRenderer = myGrid.GetDefaultRenderer() myRenderer.__class__ = MyRenderer.__class__
TypeError: __class__ assignment only supported for heap types or ModuleType subclasses
This means that
GetDefaultRenderer is not very useful in python. Evidently one can keep track of the python object without relying on
GetDefaultRenderer, but I feel this is a particular instance of a more general problem with these methods that return pointers. And I wonder if there is something that we could do in sip for these methods.