main.py 文件源码

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

项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码
def onView(self):
        """
        Attempts to load the image and display it
        """
        filepath = self.photoTxt.GetValue()
        img = wx.Image(filepath, 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.Bitmap(img))
        self.panel.Refresh()
        self.mainSizer.Fit(self.frame)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号