本文整理汇总了Python中tkinter._setit方法的典型用法代码示例。如果您正苦于以下问题:Python tkinter._setit方法的具体用法?Python tkinter._setit怎么用?Python tkinter._setit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter
的用法示例。
在下文中一共展示了tkinter._setit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_menu
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import _setit [as 别名]
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)
示例2: SetMenu
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import _setit [as 别名]
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)
示例3: on_skills_ready
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import _setit [as 别名]
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)
示例4: _refresh_options
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import _setit [as 别名]
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)