from abc import ABC, abstractmethod
from PyQt5.QtWidgets import QMainWindow
class _ControlGUI(QMainWindow, ABC):
pass
The very simple code above is raising an error that is not very clear to me.
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
My goal is to define a base class _ControlGUI
with the mandatory structure/properties; and then define multiple concrete classes inheriting from it, with additional functionalities/properties. All those concrete classes are small GUIs, and thus inherit from QMainWindow
, thus I thought it would be best to have the abstract class inherit from QMainWindow
directly. However, it doesn't seem to be possible.
What is the best design, solution to this problem? My current idea is to define the abstract class without QMainWindow
and to have all the concrete class inherit from _ControlGUI
and from QMainWindow
.