wxpython: automatically resize a static image (staticbitmap) to fit into size

前端 未结 1 1290
一个人的身影
一个人的身影 2021-02-10 01:17

My wxPython project has a frame, with multiple nested sizers.

One of the sizers contains a wxStaticImage with a bitmap that is read from a file.

I need the image

相关标签:
1条回答
  • 2021-02-10 01:40

    You will need to catch EVT_SIZE or EVT_SIZING. You can check out this tutorial I wrote about creating an image viewer. It has some scaling code in it: http://www.blog.pythonlibrary.org/2010/03/26/creating-a-simple-photo-viewer-with-wxpython/

    I would just take that scaling code and use it to update your image. You'll want to make sure you stop scaling your image up past its maximum size or you'll end up with a lot of pixelization though.

    0 讨论(0)
提交回复
热议问题