Closed villares closed 6 years ago
It looks like you're trying to use Python 3's super
(and old-style classes). Here's a working version of your program:
def setup():
a = A(5)
a.plot()
b = B(10)
b.plot()
class A(object):
def __init__(self, psize):
self.s = psize
self.x, self.y = random(width), random(height)
def plot(self):
ellipse(self.x, self.y, self.s, self.s)
class B(A):
def __init__(self, psize):
super(B, self).__init__(psize)
# TypeError:super() takes 1-2 arguments (0 given)
# A.__init__(self, psize) # will work fine...
self.c = color(random(256))
Note class A(object):
instead of class A()
, and note the correct invocation of super
.
Thanks!!!
On Sun, Oct 29, 2017, 23:54 Jonathan Feinberg notifications@github.com wrote:
Closed #196 https://github.com/jdf/Processing.py-Bugs/issues/196.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jdf/Processing.py-Bugs/issues/196#event-1315849388, or mute the thread https://github.com/notifications/unsubscribe-auth/ADhgDM7NPBpU4w-j086eGrugF42x3Gubks5sxSw3gaJpZM4QKkO0 .
I have written a small test example...