本文整理汇总了Python中sugar3.graphics.toolbarbox.ToolbarButton.set_icon_name方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarButton.set_icon_name方法的具体用法?Python ToolbarButton.set_icon_name怎么用?Python ToolbarButton.set_icon_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbarbox.ToolbarButton
的用法示例。
在下文中一共展示了ToolbarButton.set_icon_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PhysicsActivity
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import set_icon_name [as 别名]
#.........这里部分代码省略.........
color = widget.get_color()
red = (color.red / 65535.0) * 255
green = (color.green / 65535.0) * 255
blue = (color.blue / 65535.0) * 255
objectColor = ((red), (green), (blue))
self.randomColor.set_active(False)
self.game.world.add.setColor(objectColor)
def resetColors(self, button):
self.game.world.add.resetColor()
def can_close(self):
self.preview = self.get_preview()
self.game.loop = False
return True
def _insert_stop_play_button(self, toolbar):
self.stop_play_toolbar = ToolbarButton()
st_toolbar = self.stop_play_toolbar
st_toolbar.props.page = Gtk.Toolbar()
st_toolbar.props.icon_name = "media-playback-stop"
self.stop_play_state = True
self.stop_play = ToolButton("media-playback-stop")
self.stop_play.set_tooltip(_("Stop"))
self.stop_play.set_accelerator(_("<ctrl>space"))
self.stop_play.connect("clicked", self.stop_play_cb)
self._insert_item(st_toolbar, self.stop_play)
self.stop_play.show()
slowest_button = RadioToolButton(group=None)
slowest_button.set_icon_name("slow-walk-milton-raposo")
slowest_button.set_tooltip(_("Run slower"))
slowest_button.connect("clicked", self._set_fps_cb, SLOWEST_FPS)
self._insert_item(st_toolbar, slowest_button)
slowest_button.show()
slow_button = RadioToolButton(group=slowest_button)
slow_button.set_icon_name("walking")
slow_button.set_tooltip(_("Run slow"))
slow_button.connect("clicked", self._set_fps_cb, SLOW_FPS)
self._insert_item(st_toolbar, slow_button)
slow_button.show()
fast_button = RadioToolButton(group=slowest_button)
fast_button.set_icon_name("running")
fast_button.set_tooltip("Run fast")
fast_button.connect("clicked", self._set_fps_cb, FAST_FPS)
self._insert_item(st_toolbar, fast_button)
fast_button.show()
fast_button.set_active(True)
toolbar.insert(self.stop_play_toolbar, -1)
self.stop_play_toolbar.show_all()
def _set_fps_cb(self, button, value):
self.game.set_game_fps(value)
def _insert_clear_all_button(self, toolbar):
self.clear_all = ToolButton("clear_all")
self.clear_all.set_tooltip(_("Erase All"))
self.clear_all.set_accelerator(_("<ctrl>a"))
self.clear_all.connect("clicked", self.clear_all_cb)
toolbar.insert(self.clear_all, -1)
示例2: PhysicsActivity
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import set_icon_name [as 别名]
#.........这里部分代码省略.........
load_project = ToolButton('load-project')
load_project.set_tooltip(_('Load project from journal'))
load_project.connect('clicked', self._load_project)
activity_button.props.page.insert(load_project, -1)
load_project.show()
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
create_toolbar.set_expanded(True)
return toolbar_box
def can_close(self):
self.preview = self.get_preview()
self.game.loop = False
return True
def _insert_stop_play_button(self, toolbar):
self.stop_play_toolbar = ToolbarButton()
st_toolbar = self.stop_play_toolbar
st_toolbar.props.page = Gtk.Toolbar()
st_toolbar.props.icon_name = 'media-playback-stop'
self.stop_play_state = True
self.stop_play = ToolButton('media-playback-stop')
self.stop_play.set_tooltip(_('Stop'))
self.stop_play.set_accelerator(_('<ctrl>space'))
self.stop_play.connect('clicked', self.stop_play_cb)
self._insert_item(st_toolbar, self.stop_play)
self.stop_play.show()
slowest_button = RadioToolButton(group=None)
slowest_button.set_icon_name('slow-walk-milton-raposo')
slowest_button.set_tooltip(_('Run slower'))
slowest_button.connect('clicked', self._set_fps_cb, SLOWEST_FPS)
self._insert_item(st_toolbar, slowest_button)
slowest_button.show()
slow_button = RadioToolButton(group=slowest_button)
slow_button.set_icon_name('walking')
slow_button.set_tooltip(_('Run slow'))
slow_button.connect('clicked', self._set_fps_cb, SLOW_FPS)
self._insert_item(st_toolbar, slow_button)
slow_button.show()
fast_button = RadioToolButton(group=slowest_button)
fast_button.set_icon_name('running')
fast_button.set_tooltip('Run fast')
fast_button.connect('clicked', self._set_fps_cb, FAST_FPS)
self._insert_item(st_toolbar, fast_button)
fast_button.show()
fast_button.set_active(True)
toolbar.insert(self.stop_play_toolbar, -1)
self.stop_play_toolbar.show_all()
def _set_fps_cb(self, button, value):
self.game.set_game_fps(value)
def _insert_clear_all_button(self, toolbar):
self.clear_all = ToolButton('clear_all')
self.clear_all.set_tooltip(_('Erase All'))
self.clear_all.set_accelerator(_('<ctrl>a'))
self.clear_all.connect('clicked', self.clear_all_cb)
toolbar.insert(self.clear_all, -1)