def __init__(self, master, values, command=None, args=(), variable=None, **kw): kw['style'] = 'TComboSmall' if variable is not None: kw['textvariable'] = variable self.variable = variable WidgetWithCommand.__init__(self) Widget.__init__(self, master, "ttk::menubutton", kw) if command: self.set_command(command, args) entries = [] for value in values: entries.append( ComboCommand(value, command=self.choose_opt, args=value)) self.__menu = ComboMenu(self, entries, auto_update=0, name="menu", tearoff=0) menu = self.__menu.menu self.menuname = menu._w self["menu"] = menu
def __init__(self, master, values, command = None, args = (), variable = None, **kw): kw['style'] = 'TComboSmall' if variable is not None: kw['textvariable'] = variable self.variable = variable WidgetWithCommand.__init__(self) Widget.__init__(self, master, "ttk::menubutton", kw) if command: self.set_command(command, args) entries = [] for value in values: entries.append(ComboCommand(value, command = self.choose_opt, args = value)) self.__menu = ComboMenu(self, entries, auto_update = 0, name="menu", tearoff=0) menu = self.__menu.menu self.menuname = menu._w self["menu"] = menu
def destroy(self): WidgetWithCommand.clean_up(self) TMenubutton.destroy(self) self.__menu = None