I’m trying to implement a custom renderer for a column in a wx.dataview.DataViewCtrl
. However different rows may have different value types for that column. So I’m trying to implement a custom renderer that can handle the different types. The problem I’m having is that the renderer isn’t even being called, apparently because the type of the value is not correct.
I tried overriding GetDefaultType()
in my DataViewCustomRenderer
to return “object” in the hope that would allow any object to be passed through. That didn’t work, so I thought maybe it’s a more specific check and it has to be that exact class and not a descendant. So I made a wrapper class:
class AnyContainer:
def __init__(self, value):
self.value = value
def __str__(self):
return str(self.value)
…and wrap all values returned from my wx.dataview.PyDataViewModel
in instances of that class. Then I modify my GetDefaultType()
to return “AnyContainer”. Still no go. The renderer is not being called.
How can I get my renderer to be called for custom data types? I can’t find an example of this being done anywhere.
Also unless I missed it I guess there’s no python glue code for this that I can look at? It’s all invisible auto-generated c or something? I tried to see what it’s looking for but if the code is there I missed it.