本文整理汇总了Python中sugar3.graphics.toolbutton.ToolButton.set_label方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.set_label方法的具体用法?Python ToolButton.set_label怎么用?Python ToolButton.set_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.set_label方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_text_icon_and_button
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_label [as 别名]
def add_text_icon_and_button(self, text, icon_name,
button_icon=None,
button_label=None,
size='large', bold=False,
color=style.COLOR_BLACK.get_html(),
justify=Gtk.Justification.LEFT,
stroke=style.COLOR_BUTTON_GREY.get_svg(),
fill=style.COLOR_TRANSPARENT.get_svg(),
icon_size=style.XLARGE_ICON_SIZE):
label = Gtk.Label()
label.set_use_markup(True)
label.set_justify(justify)
if bold:
text = '<b>' + text + '</b>'
span = '<span foreground="%s" size="%s">' % (color, size)
label.set_markup(span + text + '</span>')
icon = Icon(pixel_size=icon_size, icon_name=icon_name,
stroke_color=stroke, fill_color=fill)
if button_icon is not None:
button = ToolButton(button_icon)
else:
button = Gtk.Button()
button.set_label(button_label)
self._attach_three(label, icon, button)
label.show()
icon.show()
button.show()
return button
示例2: add_button
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_label [as 别名]
def add_button(self, button_label, callback, arg=None, button_icon=None):
if button_icon is not None:
button = ToolButton(button_icon)
else:
button = Gtk.Button()
button.set_label(button_label)
self._attach_center(button)
if callback is not None:
if arg is None:
button.connect('clicked', callback)
else:
button.connect('clicked', callback, arg)
button.show()
return button