Closed youstanzr closed 2 years ago
super(graphviz.Graph, self).__init__()
You need to accept the same __init__
arguments and pass them on to the base class (otherwise calls that use arguments won't work because your subclass is not compatible with the base class):
import graphviz
class MyGraph(graphviz.Graph):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
g = MyGraph()
with g.subgraph() as s:
s.node('spam')
g
I am trying to create a simple inheritance class to Graph but it seems to be failing when calling the subgraph()
code below:
Traceback below: