Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerome-diver/b650f4cf16f1c67cf248555eececcc45 to your computer and use it in GitHub Desktop.
Save jerome-diver/b650f4cf16f1c67cf248555eececcc45 to your computer and use it in GitHub Desktop.
# Test zope.interface to get abstract class with Python (from jupyter)
from zope.interface import Interface
from zope.interface.declarations import implementer
from PyQt5.QtCore import QObject
class Base(zope.interface.Interface, QObject):
"""My base cabstract class"""
name = zope.interface.Attribute("Base abstract class")
def show_me(self, x=None):
"""you have to create it !"""
@implementer(Base)
class Child1():
def __init__(self):
print("Ok, you created a Child1 object")
#def show_me(self, x=None):
# print(x)
test = Child1()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-20-3d59ca4f2d1e> in <module>
2 from zope.interface.declarations import implementer
3 from PyQt5.QtCore import QObject
----> 4 class Base(zope.interface.Interface, QObject):
5 """My base cabstract class"""
6 name = zope.interface.Attribute("Base abstract class")
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment