示例#1
0
    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
示例#2
0
	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
示例#3
0
 def destroy(self):
     WidgetWithCommand.clean_up(self)
     TMenubutton.destroy(self)
     self.__menu = None
示例#4
0
	def destroy(self):
		WidgetWithCommand.clean_up(self)
		TMenubutton.destroy(self)
		self.__menu = None