Python tkinter._setit() Examples

The following are 8 code examples of tkinter._setit(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: ttk.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def set_menu(self, default=None, *values):
        """Build a new menu of radiobuttons with *values and optionally
        a default value."""
        menu = self['menu']
        menu.delete(0, 'end')
        for val in values:
            menu.add_radiobutton(label=val,
                command=tkinter._setit(self._variable, val, self._callback))

        if default:
            self._variable.set(default) 
Example #2
Source File: dynOptionMenuWidget.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def SetMenu(self,valueList,value=None):
        """
        clear and reload the menu with a new set of options.
        valueList - list of new options
        value - initial value to set the optionmenu's menubutton to
        """
        self['menu'].delete(0,'end')
        for item in valueList:
            self['menu'].add_command(label=item,
                    command=_setit(self.variable,item,self.command))
        if value:
            self.variable.set(value) 
Example #3
Source File: ttk.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def set_menu(self, default=None, *values):
        """Build a new menu of radiobuttons with *values and optionally
        a default value."""
        menu = self['menu']
        menu.delete(0, 'end')
        for val in values:
            menu.add_radiobutton(label=val,
                command=tkinter._setit(self._variable, val, self._callback))

        if default:
            self._variable.set(default) 
Example #4
Source File: dynOptionMenuWidget.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def SetMenu(self,valueList,value=None):
        """
        clear and reload the menu with a new set of options.
        valueList - list of new options
        value - initial value to set the optionmenu's menubutton to
        """
        self['menu'].delete(0,'end')
        for item in valueList:
            self['menu'].add_command(label=item,
                    command=_setit(self.variable,item,self.command))
        if value:
            self.variable.set(value) 
Example #5
Source File: clai_emulator.py    From clai with MIT License 5 votes vote down vote up
def on_skills_ready(self, skills_as_array: List[str]):
        self.selected_skills_dropmenu.configure(state="active")
        self.selected_skills_dropmenu["menu"].delete(0, 'end')

        for skill in skills_as_array[1:-1]:
            name_skill, active = self.clear_text(skill)
            self.selected_skills_dropmenu["menu"].add_command(
                label=name_skill,
                command=tk._setit(self.selected_skills, name_skill))

            if active:
                self.presenter.current_active_skill = self.extract_skill_name(name_skill)[0]
                self.selected_skills.set(name_skill) 
Example #6
Source File: Combo.py    From guizero with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _refresh_options(self):
        # save which option was selected
        selected = self.value

        self._combo_menu.tk.delete(0, END)

        # Re-add all options
        # This uses an internal tk method _setit which is a bit naughty
        for item in self._options:
            self._combo_menu.tk.add_command(label=item, command=_setit(self._selected, item, self._command_callback))

        self.description = "[Combo] object with options  " + str(self._options)

        # set the option which was previously selected
        self._set_option(selected) 
Example #7
Source File: ttk.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def set_menu(self, default=None, *values):
        """Build a new menu of radiobuttons with *values and optionally
        a default value."""
        menu = self['menu']
        menu.delete(0, 'end')
        for val in values:
            menu.add_radiobutton(label=val,
                command=tkinter._setit(self._variable, val, self._callback))

        if default:
            self._variable.set(default) 
Example #8
Source File: dynOptionMenuWidget.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def SetMenu(self,valueList,value=None):
        """
        clear and reload the menu with a new set of options.
        valueList - list of new options
        value - initial value to set the optionmenu's menubutton to
        """
        self['menu'].delete(0,'end')
        for item in valueList:
            self['menu'].add_command(label=item,
                    command=_setit(self.variable,item,self.command))
        if value:
            self.variable.set(value)