I'm trying to inherit a class from visual.DotStim like this
class JitterDots(visual.DotStim):
...
I always get the infamous metaclass error:
TypeError: Error when calling the metaclass bases metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
I understand you can fix this by merging all base classes' metaclasses, but I can't see where DotStim or its bases use any metaclasses, so I'm really confused by this.
Any suggestions?
This seems to be working for me:
from psychopy.visual import dot
class JitterDots(dot.DotStim):
pass
Unrelated to your immediate question, but still a possible pitfall:
I also noticed that some of the bases/parents of DotStim
inherit directly from object
, but never initialize their parent via super()
-- although super()
is called in DotStim.__init__()
. However, "doing so will cause other classes' __init__
methods to not be called", according to https://fuhm.net/super-harmful/