def __init__(self, *args, **kwargs): buttons = kwargs.pop("buttons") width = kwargs.pop("width", .20) super(SimpleMenuDialog, self).__init__(*args, **kwargs) self.size = (-1, -1) self.pos = (0, 0) self.anchor = constants.TOP_LEFT num_buttons = len(buttons) height = (.06 * num_buttons) + .01 self.width = width self.button_panel = \ widget.BorderedWidget(self, (-.5, -.5), (self.width + .02, height), anchor=constants.MID_CENTER, background_color=g.colors["dark_blue"], border_color=g.colors["white"], borders=constants.ALL) y_pos = .01 for button in buttons: if button.parent is not None: button.remove_hooks() button.parent = self.button_panel button.add_hooks() button.pos = (.01, y_pos) button.size = (self.width, .05) button.text_shrink_factor = .70 y_pos += .06
def __init__(self, parent, *args, **kwargs): self.parent = parent self.key_list = kwargs.pop("key_list", None) self.desc_func = kwargs.pop("desc_func", lambda pane, key: NullDialog) super(ChoiceDescriptionDialog, self).__init__(parent, *args, **kwargs) self.description_pane = \ widget.BorderedWidget(self, (-1, 0), (-.45, -.85), anchor = constants.TOP_RIGHT)
def __init__(self, *args, **kwargs): buttons = kwargs.pop("buttons", []) width = kwargs.pop("width", .20) super(SimpleMenuDialog, self).__init__(*args, **kwargs) self.size = (-1, -1) self.pos = (0, 0) self.anchor = constants.TOP_LEFT self.width = width self.button_panel = \ widget.BorderedWidget(self, (-.5, -.5), (0.22, 0.43), anchor=constants.MID_CENTER, background_color="dark_blue", border_color="white", borders=constants.ALL) self.buttons = buttons