本文整理匯總了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)