def on_app(self): '''Called when this element is associated with an App. Initializes drawables.''' Button.on_app(self) self.box = Sprite(app=self.app, surface=pygame.image.load( 'res/img/button_75px_gray.png').convert(), x=415, y=560) self.label = Label(app=self.app, font=pygame.font.Font('res/font/Oswald-Regular.ttf', 16), text='Next', x=415, y=560, color=COLOR.WHITE, center_x=75)
def on_app(self): '''Called when this element is associated with an App. Initializes drawables.''' Button.on_app(self) self.box = Sprite(app=self.app, surface=pygame.image.load( 'res/img/button_150px_red.png').convert(), x=300, y=230) self.label = Label(app=self.app, font=pygame.font.Font('res/font/Oswald-Regular.ttf', 42), text='Start', x=300, y=230, color=COLOR.WHITE, center_x=150, center_y=60)
def dehighlight(self): '''Called when the button is no longer hovered over. Changes the color of the box.''' Button.dehighlight(self) self.box.surface = pygame.image.load( 'res/img/button_150px_red.png').convert()
def __init__(self): Button.__init__(self) self.click_allowed = True
def highlight(self): '''Called when the button is hovered over. Changes the color of the box.''' Button.highlight(self) if self.click_allowed: self.box.surface = pygame.image.load( 'res/img/button_150px_gray.png').convert()