That fails with the message:
TypeError: Error when calling the metaclass bases
type 'function' is not an acceptable base type
The object I refer to does indeed seem to be a function:
In : type(wx.propgrid.EnumProperty)
Out: function
Why is it a function? (It certainly looks like it's being defines as a
class in wxPython/wx/propgrid.py),
Keep looking. Near the bottom there is this line:
EnumProperty = NewEnumProperty
Which I'm assuming is replacing EnumProperty with a factory function that creates an instance of the real class.
How can I create a derived class of EnumProperty?
Unfortunately I don't know enough about propgrid to be able to help. Hopefully Jaakko Salli will see this and answer your questions or give you suggestions for an alternate approach.
Thank you Robin!
That replacement certainly seems to explains why it is a function rather than a class.
I did keep looking and found that propgrid also contains PyEnumProperty which remains a class.
I’m just beginning to play with it now, but I have successfully created a subclass from PyEnumProperty and exchanged a method. There is a good chance it will do what I need.
For future reference: propgrid has several pairs of classes both with and without a “Py” prefix to their name, and it doesn’t seem too far-fetched that the same situation applies to the other ones. As a working hypthesis, when possible use:
class SubClass(wx.propgrid.PySomePropGridClass):
rather than:
class SubClass(wx.propgrid.SomePropGridClass):