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


Python ComboBox.show方法代码示例

本文整理汇总了Python中sugar3.graphics.combobox.ComboBox.show方法的典型用法代码示例。如果您正苦于以下问题:Python ComboBox.show方法的具体用法?Python ComboBox.show怎么用?Python ComboBox.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sugar3.graphics.combobox.ComboBox的用法示例。


在下文中一共展示了ComboBox.show方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ToolComboBox

# 需要导入模块: from sugar3.graphics.combobox import ComboBox [as 别名]
# 或者: from sugar3.graphics.combobox.ComboBox import show [as 别名]
class ToolComboBox(Gtk.ToolItem):
    '''
    UI for ToolComboBox
    A ToolComboBox is a widget that allows the user to choose
    from a list of valid choices. The ToolComboBox displays
    the selected choice. When activated, it displays a popup
    which allows the user to make a new choice.
    Functions:
        ToolComboBox.new()
            Returns a new tool combobox.
    Keyword Args:
        combo:
            The combo attribute is like a Gtk.ComboBox.
            There are two types: Either user passed or
            automatic.
        List of items in ToolComboBox
            It can be also set to none.
    '''

    __gproperties__ = {
        'label-text': (str, None, None, None, GObject.PARAM_WRITABLE),
    }
    '''
        label-text
        The text displayed on the label for ToolComboBox.
    '''

    def __init__(self, combo=None, **kwargs):
        self.label = None
        self._label_text = ''

        GObject.GObject.__init__(self, **kwargs)

        self.set_border_width(style.DEFAULT_PADDING)

        hbox = Gtk.HBox(False, style.DEFAULT_SPACING)

        self.label = Gtk.Label(label=self._label_text)
        hbox.pack_start(self.label, False, False, 0)
        self.label.show()

        if combo:
            self.combo = combo
        else:
            self.combo = ComboBox()

        hbox.pack_start(self.combo, True, True, 0)
        self.combo.show()

        self.add(hbox)
        hbox.show()

    def do_set_property(self, pspec, value):
        if pspec.name == 'label-text':
            self._label_text = value
            if self.label:
                self.label.set_text(self._label_text)
开发者ID:Hrishi1999,项目名称:sugar-toolkit-gtk3,代码行数:59,代码来源:toolcombobox.py

示例2: IconComboBox

# 需要导入模块: from sugar3.graphics.combobox import ComboBox [as 别名]
# 或者: from sugar3.graphics.combobox.ComboBox import show [as 别名]
class IconComboBox(Gtk.ToolItem):
    def __init__(self, icon_name, **kwargs):
        Gtk.ToolItem.__init__(self, **kwargs)

        self.icon_name = icon_name
        self.set_border_width(style.DEFAULT_PADDING)

        self.combo = ComboBox()
        self.combo.set_focus_on_click(False)
        self.combo.show()

        self.add(self.combo)

    def append_item(self, i, text):
        self.combo.append_item(i, text, icon_name=self.icon_name)
开发者ID:sugarlabs,项目名称:record-activity,代码行数:17,代码来源:iconcombobox.py

示例3: combo_factory

# 需要导入模块: from sugar3.graphics.combobox import ComboBox [as 别名]
# 或者: from sugar3.graphics.combobox.ComboBox import show [as 别名]
def combo_factory(combo_array, toolbar, callback, cb_arg=None, tooltip=None, default=None):
    """Factory for making a toolbar combo box"""
    combo = ComboBox()
    if tooltip is not None and hasattr(combo, "set_tooltip_text"):
        combo.set_tooltip_text(tooltip)
    if cb_arg is not None:
        combo.connect("changed", callback, cb_arg)
    else:
        combo.connect("changed", callback)
    for i, selection in enumerate(combo_array):
        combo.append_item(i, selection, None)
    combo.show()
    toolitem = Gtk.ToolItem()
    toolitem.add(combo)
    if hasattr(toolbar, "insert"):  # the main toolbar
        toolbar.insert(toolitem, -1)
    else:  # or a secondary toolbar
        toolbar.props.page.insert(toolitem, -1)
    toolitem.show()
    if default is not None:
        combo.set_active(combo_array.index(default))
    return combo
开发者ID:Daksh,项目名称:portfolio,代码行数:24,代码来源:toolbar_utils.py

示例4: ToolComboBox

# 需要导入模块: from sugar3.graphics.combobox import ComboBox [as 别名]
# 或者: from sugar3.graphics.combobox.ComboBox import show [as 别名]
class ToolComboBox(Gtk.ToolItem):

    __gproperties__ = {
        'label-text': (str, None, None, None, GObject.ParamFlags.WRITABLE),
    }

    def __init__(self, combo=None, **kwargs):
        self.label = None
        self._label_text = ''

        GObject.GObject.__init__(self, **kwargs)

        self.set_border_width(style.DEFAULT_PADDING)

        hbox = Gtk.HBox(False, style.DEFAULT_SPACING)

        self.label = Gtk.Label(label=self._label_text)
        hbox.pack_start(self.label, False, False, 0)
        self.label.show()

        if combo:
            self.combo = combo
        else:
            self.combo = ComboBox()

        hbox.pack_start(self.combo, True, True, 0)
        self.combo.show()

        self.add(hbox)
        hbox.show()

    def do_set_property(self, pspec, value):
        if pspec.name == 'label-text':
            self._label_text = value
            if self.label:
                self.label.set_text(self._label_text)
开发者ID:sugarlabs,项目名称:sugar-toolkit-gtk3,代码行数:38,代码来源:toolcombobox.py


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