python类Image()的实例源码

smalictrace.py 文件源码 项目:linux-pentest-util 作者: fikr4n 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def _create_legend(self):
        icons = (
            (gtk.STOCK_FILE, 'Class'),
            (gtk.STOCK_EXECUTE, 'Method'),
            (gtk.STOCK_SELECT_FONT, 'Field'),
            (gtk.STOCK_DELETE, 'Declaration not found'),
            (gtk.STOCK_INFO, 'Miscellaneous (info)'),
            (u'?', 'Direct call – e.g. static, private, etc'),
            (u'?', 'Virtual call (? + ?)'),
            (u'?', 'Virtual call (indirect) which could be performed because '
                'of polymorphism'),
            (u'?', 'Virtual call (direct only) which does not actually '
                'performed – e.g. interface method'),
            (u'?', 'Super call (? + ?)'),
            (u'?', 'Super call (indirect) because direct super does not '
                'declare the method'),
            (u'?', 'Super call (direct only) which does not actually '
                'performed – e.g. not declared here'),
        )
        table = gtk.Table(7, 5)
        table.set_border_width(8)
        table.set_row_spacings(8)
        table.set_col_spacings(8)
        separator = gtk.VSeparator()
        table.attach(separator, 2, 3, 0, 7, 0)
        x, y = 0, 0
        for icon, desc in icons:
            if len(icon) == 1:
                image = gtk.Label(icon)
            else:
                image = gtk.Image()
                image.set_from_stock(icon, gtk.ICON_SIZE_MENU)
            image.set_alignment(1, 0.5)
            label = gtk.Label(desc)
            label.set_alignment(0, 0.5)
            table.attach(image, x + 0, x + 1, y, y + 1, gtk.FILL)
            table.attach(label, x + 1, x + 2, y, y + 1, gtk.FILL)
            y += 1
            if y == 5 and x == 0:
                x, y = 3, 0
        frame = gtk.Frame('Legend')
        frame.add(table)
        return frame
win_history.py 文件源码 项目:wahcade 作者: sairuk 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def __init__(self, WinMain):
        #set main window
        self.WinMain = WinMain
        self.layout_filename = ''
        self.histview_ok = True
        #open history viewer ini
        self.histview_ini = MameWahIni(os.path.join(CONFIG_DIR, 'histview.ini'), 'default', '0.16')
        if os.path.exists(os.path.join(CONFIG_DIR, 'ini', self.WinMain.current_emu + '.his')):
            self.cpviewer_ini = MameWahIni(os.path.join(CONFIG_DIR, 'ini', self.WinMain.current_emu + '.his'), 'default')
        if not os.path.isfile(self.histview_ini.get('history_dat_file')):
            self.WinMain.log_msg("Warning: history file: [%s] does not exist" % (
                self.histview_ini.get('history_dat_file')))
            self.histview_ok = False
        self.layout_filename = self.histview_ini.get('history_layout')
        if not os.path.isfile(self.layout_filename):
            self.WinMain.log_msg("Warning: history layout: [%s] does not exist" % (self.layout_filename))
            self.histview_ok = False
        #build the window
        self.winHistory = gtk.Fixed()
        self.winHistory.set_has_window(True)
        self.imgBackground = gtk.Image()
        self.lblHeading = gtk.Label()
        self.sclHistory = ScrollList()
        self.winHistory.add(self.imgBackground)
        self.winHistory.add(self.make_evb_widget(self.lblHeading))
        self.winHistory.add(self.sclHistory.fixd)
        WinMain.fixd.add(self.winHistory)
        self.imgBackground.show()
        self.lblHeading.show()
        self.winHistory.show()
        #build list
        self.lsHistory = []
        self.sclHistory.auto_update = True
        self.sclHistory.display_limiters = self.WinMain.wahcade_ini.getint('show_list_arrows', 0)
        #widgets
        self._histview_items = [
            (8, self.lblHeading),
            (21, self.sclHistory)]
        #get history
        self.history = self.read_history(self.histview_ini.get('history_dat_file'))
        #app number
        self.app_number = 0
fanim_timeline.py 文件源码 项目:gimp-fanim 作者: douglasvini 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _setup_playbackbar(self):
        playback_bar = gtk.HBox()
        button_size = 30
        stock_size = gtk.ICON_SIZE_BUTTON

        # play button
        ## image
        image_play = gtk.Image()
        image_play.set_from_stock(gtk.STOCK_MEDIA_PLAY,stock_size)
        image_pause = gtk.Image()
        image_pause.set_from_stock(gtk.STOCK_MEDIA_PAUSE,stock_size)
        ## append the images to a list to be used later on
        self.play_button_images.append(image_play)
        self.play_button_images.append(image_pause)
        ## button
        b_play = gtk.Button()
        b_play.set_image(image_play)
        b_play.set_size_request(button_size,button_size)

        b_tostart = Utils.button_stock(gtk.STOCK_MEDIA_PREVIOUS,stock_size)
        b_toend = Utils.button_stock(gtk.STOCK_MEDIA_NEXT,stock_size)
        b_prev = Utils.button_stock(gtk.STOCK_MEDIA_REWIND,stock_size)
        b_next = Utils.button_stock(gtk.STOCK_MEDIA_FORWARD,stock_size)

        b_repeat = Utils.toggle_button_stock(gtk.STOCK_REFRESH,stock_size)

        # connecting the button with callback
        b_play.connect('clicked',self.on_toggle_play)
        b_repeat.connect('toggled',self.on_replay)

        b_next.connect('clicked',self.on_goto,NEXT,True)
        b_prev.connect('clicked',self.on_goto,PREV,True)
        b_toend.connect('clicked',self.on_goto,END,True)
        b_tostart.connect('clicked',self.on_goto,START,True)


        # add to the disable on play list
        w = [b_repeat,b_prev,b_next,b_tostart,b_toend]
        map(lambda x: self.widgets_to_disable.append(x),w)
        self.play_bar = playback_bar

        # set the tooltips
        b_play.set_tooltip_text("Animation play/pause")
        b_repeat.set_tooltip_text("Animation replay active/deactive")
        b_prev.set_tooltip_text("To the previous frame")
        b_next.set_tooltip_text("To the next frame")
        b_tostart.set_tooltip_text("To the start frame")
        b_toend.set_tooltip_text("To the end frame")

        # packing everything in gbar
        playback_bar.pack_start(b_tostart,False,False,0)
        playback_bar.pack_start(b_prev,False,False,0)
        playback_bar.pack_start(b_play,False,False,0)
        playback_bar.pack_start(b_next,False,False,0)
        playback_bar.pack_start(b_toend,False,False,0)
        playback_bar.pack_start(b_repeat,False,False,0)

        return playback_bar


问题


面经


文章

微信
公众号

扫码关注公众号