Created
June 2, 2019 04:10
-
-
Save jerome-diver/b650f4cf16f1c67cf248555eececcc45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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