New to Python, just writing a noddy example, getting a weird error.
display.py
import abc
from graphics import *
class Display:
pass
class Visual(metaclass=abc.ABCMeta):
"""Represents a thing which can be drawn on a display"""
@abc.abstractmethod
def draw(disp: Display) -> None:
"""Draws the visual to the display"""
raise NotImplementedError()
class Display(metaclass=abc.ABCMeta):
def __init__(self) -> None:
__visuals = []
def add_visual( vis: Visual ):
__visuals.append(vis)
def draw() -> None:
for visual in __visuals:
visual.draw(self)
graphics_display.py
from graphics import *
from gfx.display import Display
class GraphicsDisplay(Display):
def __init__(self, window : GraphWin) -> None:
super().__init__()
__window = window
def get_window() -> GraphWin:
return __window
The traceback is
>>> win = GraphWin()
>>> display = GraphicsDisplay(window=win)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/julian/test/gfx_test/gfx/graphics_display.py", line 6, in __init__
Display.__init__(self)
TypeError: __init__() takes 1 positional argument but 2 were given
graphics.py is here
Why does it think the base init is getting 2 arguments?