As I mentioned in a previous message, I’m trying to get Dabo to work with Python3 and wxPython 4.x. Dabo works mainly by the use of mixin classes that add a consistent interface to all objects, but these mixins can make debugging difficult sometimes.
As I’ve progressed, I’m now seeing the error message in the subject appearing consistently. So I’ve created a small sample program that illustrates the problem using a very simple mixin class:
simple.py
import wx
class SimpleMixin():
def __init__(self, name=None):
print("Mixin init")
self._name = name or "Default"
print("Mixin init DONE")
def simple_method(self):
print(id(self), self._name)
class SimpleFrame(SimpleMixin, wx.Frame):
def __init__(self, parent, name=None):
print("Subclass init")
super(SimpleFrame, self).__init__(name)
print("Subclass init DONE")
if name == “main”:
app = wx.App()
f = SimpleFrame(None, "Test")
f.Show()
app.MainLoop()
When I run this program, I get the following output:
(wxenv)ed@imac:~/projects/dabo(2phase)$ python simple.py
Subclass init
Mixin init
Mixin init DONE
Subclass init DONE
Traceback (most recent call last):
File “simple.py”, line 22, in
f.Show()
RuntimeError: super-class init() of type SimpleFrame was never called
(wxenv)ed@imac:~/projects/dabo(2phase)$
It shows that the init() methods of both the subclass and the mixin were called and completed in the expected order, so I don’t understand why I’m seeing this error message.
– Ed Leafe