本文整理匯總了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: update_disk_optionmenu
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _setit [as 別名]
def update_disk_optionmenu(self):
disk_list = controller.get_disk_list()
menu = self.menu_choose_disk['menu']
# clear all options
menu.delete(0, 'end')
# add new
if not disk_list:
raise Exception("No Acceptable disks found")
else:
for disk in disk_list:
menu.add_command(label=disk, command=_setit(self.disk_choice,disk))
self.disk_choice.set(disk)
示例4: refesh_span_options
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _setit [as 別名]
def refesh_span_options(self,*event):
self.load_span_selection['menu'].delete(0,'end')
for choice in self.beam_labels:
self.load_span_selection['menu'].add_command(label=choice, command=tk._setit(self.load_span_select, choice))