本文整理汇总了Python中tkinter.ttk.Combobox.state方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.state方法的具体用法?Python Combobox.state怎么用?Python Combobox.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Combobox
的用法示例。
在下文中一共展示了Combobox.state方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_version_combobox
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import state [as 别名]
def set_version_combobox(box: ttk.Combobox, item: 'UI.Item') -> list:
"""Set values on the variant combobox.
This is in a function so itemconfig can reuse it.
It returns a list of IDs in the same order as the names.
"""
ver_lookup, version_names = item.get_version_names()
if len(version_names) <= 1:
# There aren't any alternates to choose from, disable the box
box.state(['disabled'])
box['values'] = [_('No Alternate Versions!')]
box.current(0)
else:
box.state(['!disabled'])
box['values'] = version_names
box.current(ver_lookup.index(item.selected_ver))
return ver_lookup
示例2: _makesetting
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import state [as 别名]
def _makesetting(setting_window, conf):
setting_label = Label(setting_window,
text=_('Setting'),
font=('courier', 20, 'bold'))
setting_label.pack(side=TOP)
style_container = Frame(setting_window)
style_container.pack(side=TOP)
style_label = Label(style_container,
text=_('Display wallpaper in style: '),
font=('courier', 15, 'bold'))
style_label.pack(side=LEFT)
style_combobox = Combobox(style_container)
available_style = {'3': 'zoom', '2': 'scaled', '1': 'stretched', '0': 'centered', '4': 'wallpaper'}
style_combobox['value'] = (_('centered'), _('stretched'), _('scaled'), _('zoom'), _('wallpaper'))
style_combobox.state(['readonly'])
style_combobox.current(int(conf['style']))
style_combobox.pack(side=LEFT)
random_container = Frame(setting_window)
random_container.pack(side=TOP)
random_label = Label(random_container,
text=_('Choose wallpaper randomly? '),
font=('courier', 15, 'bold'))
random_label.pack(side=LEFT)
random_checkbutton = Checkbutton(random_container)
random_checkbutton.pack(side=LEFT)
if conf['random'] == "1":
random_checkbutton.select()
interval_container = Frame(setting_window)
interval_container.pack(side=TOP)
interval_label = Label(interval_container,
text=_('Change wallpaper every '),
font=('courier', 15, 'bold'))
interval_label.pack(side=LEFT)
interval_text = Text(interval_container, height=1, width=4)
interval_text.insert(END, conf['interval'])
interval_text.pack(side=LEFT)
minute_label = Label(interval_container,
text=_(' minutes.'),
font=('courier', 15, 'bold'))
minute_label.pack(side=LEFT)