gui.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:stopgo 作者: notklaatu 项目源码 文件源码
def TakeSnapshot(self,e,args):

        logging.exception('CAPTURE')
        if self.camset == 1:
            self.framlog += 1

            #print(self.camhero)#DEBUG
            vidcap = vlc.libvlc_video_take_snapshot(self.player,0,os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'),0,0)
            self.cur.execute('INSERT INTO Timeline VALUES(Null,?,?)', (str(self.framlog).zfill(3)+'.png',0))
            # add graphically to timeline
            img = self.MakeThumbnail(os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'), self.thumbsize)
            self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, wx.BitmapFromImage(img),name=str(self.framlog).zfill(3)+'.png') 
            self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
            self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
            self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )
            logging.exception(self.imageCtrl.GetId() )
            self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )

            # scroll right 100% to get close to new frame
            self.panel3.Scroll(self.thumbsize,0)
            self.Layout()
            # draw new frame
            self.hbox2.Layout()
            self.panel3.Refresh()
            # scroll WAY right again to show frame
            self.panel3.Scroll(200,0)
            # send the shot to onion skin
            img = os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png')
            self.OnionSkin(img)
            logging.exception(self.framlog)

        else:
            dlg = wx.MessageDialog(self, 'Please select your camera first.','',wx.OK | wx.ICON_ERROR)
            val = dlg.ShowModal()
            if val == wx.ID_OK:
                dlg.Destroy()
            if val == wx.ID_CANCEL:
                dlg.Destroy()

        self.player.play()
        self.brec.SetBitmapLabel(self.brecicon)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号