viewer.py 文件源码

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

项目:pinder 作者: dhharris 项目源码 文件源码
def view(self, file):
        '''
        Called when loading a new image. Pass arg bytesIO image file
        '''
        img = wx.Image(file, wx.BITMAP_TYPE_ANY)
        # scale the image, preserving the aspect ratio
        W = img.GetWidth()
        H = img.GetHeight()
        if W > H:
            NewW = self.PhotoMaxSize
            NewH = self.PhotoMaxSize * H / W
        else:
            NewH = self.PhotoMaxSize
            NewW = self.PhotoMaxSize * W / H
        img = img.Scale(NewW, NewH)

        self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
        self.panel.Refresh()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号