本文整理汇总了Python中Tkinter.OptionMenu.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python OptionMenu.__init__方法的具体用法?Python OptionMenu.__init__怎么用?Python OptionMenu.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.OptionMenu
的用法示例。
在下文中一共展示了OptionMenu.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Tkinter import OptionMenu [as 别名]
# 或者: from Tkinter.OptionMenu import __init__ [as 别名]
def __init__(self, parent, variable=None, values=None, **kwargs):
if values is None:
values = []
self._var = variable or StringVar()
OptionMenu.__init__(self, parent, self._var, *values, **kwargs)
if values:
self._var.set(values[0])
示例2: __init__
# 需要导入模块: from Tkinter import OptionMenu [as 别名]
# 或者: from Tkinter.OptionMenu import __init__ [as 别名]
def __init__(self, master, variable, value, *values, **kwargs):
kwargsCopy = copy.copy(kwargs)
if 'highlightthickness' in kwargs.keys():
del kwargs['highlightthickness']
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
self.variable = variable
self.command = kwargs.get('command')
示例3: __init__
# 需要导入模块: from Tkinter import OptionMenu [as 别名]
# 或者: from Tkinter.OptionMenu import __init__ [as 别名]
def __init__(self, master, variable, value, *values, **kwargs):
#get a copy of kwargs before OptionMenu.__init__ munges them
kwargsCopy=copy.copy(kwargs)
if 'highlightthickness' in kwargs.keys():
del(kwargs['highlightthickness'])
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
self.config(highlightthickness = kwargsCopy.get('highlightthickness'))
self.variable = variable
self.command = kwargs.get('command')
示例4: __init__
# 需要导入模块: from Tkinter import OptionMenu [as 别名]
# 或者: from Tkinter.OptionMenu import __init__ [as 别名]
def __init__(self, master, variable, value, *values, **kwargs):
# TODO copy value instead of whole dict
kwargsCopy=copy.copy(kwargs)
if 'highlightthickness' in kwargs.keys():
del(kwargs['highlightthickness'])
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
#self.menu=self['menu']
self.variable=variable
self.command=kwargs.get('command')
示例5: __init__
# 需要导入模块: from Tkinter import OptionMenu [as 别名]
# 或者: from Tkinter.OptionMenu import __init__ [as 别名]
def __init__(self, master):
self.var = StringVar(master)
self.var.set('Selecione um arquivo')
data_files = sorted(_list_data_files())
OptionMenu.__init__(self, master, self.var, *data_files)