当前位置: 首页>>代码示例>>Python>>正文


Python Combobox.state方法代码示例

本文整理汇总了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
开发者ID:BenVlodgi,项目名称:BEE2.4,代码行数:19,代码来源:contextWin.py

示例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)
开发者ID:funagi,项目名称:wallpapoz,代码行数:45,代码来源:wallpapoz_main_window.py


注:本文中的tkinter.ttk.Combobox.state方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。