You are invoking the parent __init__
wrong; use super(menu, self).__init__(*args, **kwargs)
. The method is bound for you by super()
.
You also misnamed menu.__init__
, missing a double underscore at the end.
class menu(pyglet.sprite.Sprite):
def __init__(self, *args, **kwargs):
super(menu, self).__init__(*args, **kwargs)
self.labels = {}
class pause_menu(menu):
def __init__(self, *args, **kwargs):
super(pause_menu, self).__init__(*args, **kwargs)
self.labels['resume'] = pyglet.text.Label('Resume Game', font_name='Times New Roman', font_size=36, x=window.main.width//2, y=window.main.height//2)
Because you passed in self
explicitly, the pyglet.sprite.Sprite.__init__()
is called with two positional arguments, both references to self
.
As a result, that second self
argument is seen as the img
argument and pyglet
tries to call the AbstractImage.get_texture()
method on it.