Python gtk 模块,STOCK_QUIT 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用gtk.STOCK_QUIT

项目:barbieri-playground    作者:barbieri    | 项目源码 | 文件源码
def _setup_actions(self):
        self._add_stock_action("Quit", stock=gtk.STOCK_QUIT)
        self._add_stock_action("Preferences", stock=gtk.STOCK_PREFERENCES)
        self._add_stock_action("Open", stock=gtk.STOCK_OPEN)
        self._add_stock_action("Play", stock=gtk.STOCK_MEDIA_PLAY)
        self._add_stock_action("Stop", stock=gtk.STOCK_MEDIA_STOP)


        act = gtk.ToggleAction("Pause", None, None, gtk.STOCK_MEDIA_PAUSE)
        self.action_group.add_action_with_accel(act, None)
        act.set_accel_group(self.accel_group)
        act.connect_accelerator()
        self.actions["Pause"] = act
    # _setup_actions()
项目:gimp-fanim    作者:douglasvini    | 项目源码 | 文件源码
def _setup_generalbar(self):
        stock_size = gtk.ICON_SIZE_BUTTON
        general_bar = gtk.HBox()

        b_about = Utils.button_stock(gtk.STOCK_ABOUT,stock_size)

        b_to_gif = Utils.button_stock(gtk.STOCK_CONVERT,stock_size)
        b_to_sprite = Utils.button_stock(gtk.STOCK_MISSING_IMAGE,stock_size)

        # TODO implement export button

        b_quit = Utils.button_stock(gtk.STOCK_QUIT,stock_size)

        # callbacks
        b_quit.connect('clicked',self.destroy)
        b_about.connect('clicked',self.on_about)

        b_to_gif.connect('clicked',self.create_formated_version,'gif')
        b_to_sprite.connect('clicked',self.create_formated_version,'spritesheet')

        # tooltips
        b_about.set_tooltip_text("About FAnim")
        b_quit.set_tooltip_text("Exit")
        b_to_gif.set_tooltip_text("Create a formated Image to export as gif animation")
        b_to_sprite.set_tooltip_text("Create a formated Image to export as spritesheet")

        # add to the disable on play list
        w = [b_about, b_to_gif,b_to_sprite, b_quit]
        map(lambda x: self.widgets_to_disable.append(x),w)

        # packing everything in gbar
        map(lambda x: general_bar.pack_start(x,False,False,0),w)

        return general_bar