def __init__(self): w, h = 300, 150 x = int((utils.SCREEN_W - w) / 2) y = int((utils.SCREEN_H - h) / 2) Tray.__init__( self, (x, y), (w, h), min_width=w, max_width=w, min_height=h, max_height=h, ) self.labels.add(Label((int(w / 2), 10), "Escape Menu", x_centered=True)) self.labels.add(Label((int(w / 2), 20), "_"*30, x_centered=True)) exit_game_button = Button( (w - 20, h - 20), "Exit Game", invert_x_pos=True, invert_y_pos=True, func=sys.exit, ) self.buttons.add(exit_game_button) save_game_button = Button( (20, h - 20), "Save Game", invert_y_pos=True, ) self.buttons.add(save_game_button) self.toggled = False self.render()
def blit(self, dest): if self.toggled: Tray.blit(self, dest)