I’m new to Python, I still have issues with the semantics of class inheritance.
The following is the relevant class from the module games.py module that I am importing:
class Text(Sprite):
"""
Alphanumeric values displayed on the screen.
"""
def __init__(self, value, size, color, angle=0,
x=0, y=0,
top=None, bottom=None, left=None, right=None,
dx=0, dy=0,
interval=1, is_collideable=True):
self._size = size
self._color = color
self._value = value
self._font = pygame.font.Font(None, self._size)
Sprite.__init__(self, self._create_surface(), angle,
x, y,
top, bottom, left, right,
dx, dy,
interval, is_collideable)
and the following is from where I’m trying to call it in my own program:
self.scorebox = games.Text (value = self.scorevar,
pygame.font.Font(ardarlingopentype, 50),
color = color.white,
x = 550,
y = 50)
As you can see the syntax is wrong, but how do I go about fixing this such that I can inherit the class Text from my own program and make FONT an accessible argument that I can change?
Thanks.
Not sure(note that you can’t used not named arguments after named and/or mix them – you have used not named argument after ‘value’) but seems that you need to modify code the following way:
And then:
OR: