我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用gi.repository.Gtk.STOCK_REMOVE。
def setup_toolbar(self): self.g_toolbar = Gtk.Toolbar() self.g_actiongroup.add_actions([ ('Add', Gtk.STOCK_ADD, None, None, None, self.on_add_lesson_clicked), ('Remove', Gtk.STOCK_REMOVE, None, None, None, self.on_remove_lesson_clicked), ('Create', Gtk.STOCK_EXECUTE, _("Create Sheet"), None, None, self.on_create_sheet), ('Randomize', None, _("Randomize"), None, None, self.on_randomize), ]) self.g_ui_manager.insert_action_group(self.g_actiongroup, 0) uixml = """ <ui> <toolbar name='ExportToolbar'> <toolitem action='Add'/> <toolitem action='Remove'/> <toolitem action='New'/> <toolitem action='Open'/> <toolitem action='Save'/> <toolitem action='SaveAs'/> <toolitem action='Create'/> <toolitem action='Randomize'/> <toolitem action='Close'/> <toolitem action='Help'/> </toolbar> <accelerator action='Close'/> <accelerator action='New'/> <accelerator action='Open'/> <accelerator action='Save'/> </ui> """ self.g_ui_manager.add_ui_from_string(uixml) self.vbox.pack_start(self.g_ui_manager.get_widget("/ExportToolbar"), False, False, 0) self.g_ui_manager.get_widget("/ExportToolbar").set_style(Gtk.ToolbarStyle.BOTH)
def setup_toolbar(self): self.g_actiongroup.add_actions([ ('Export', Gtk.STOCK_EXECUTE, _("Export"), None, None, self.on_export), ('Add', Gtk.STOCK_ADD, None, None, None, self.on_add_lesson_clicked), ('Remove', Gtk.STOCK_REMOVE, None, None, None, self.on_remove_lesson_clicked), ]) self.g_ui_manager.insert_action_group(self.g_actiongroup, 0) uixml = """ <ui> <toolbar name='ExportToolbar'> <toolitem action='Add'/> <toolitem action='Remove'/> <toolitem action='New'/> <toolitem action='Open'/> <toolitem action='Save'/> <toolitem action='SaveAs'/> <toolitem action='Export'/> <toolitem action='Close'/> <toolitem action='Help'/> </toolbar> <accelerator action='Close'/> <accelerator action='New'/> <accelerator action='Open'/> <accelerator action='Save'/> </ui> """ self.g_ui_manager.add_ui_from_string(uixml) self.g_vbox.pack_start(self.g_ui_manager.get_widget("/ExportToolbar"), False, False, 0) self.g_ui_manager.get_widget("/ExportToolbar").set_style(Gtk.ToolbarStyle.BOTH)