问题描述
我正在使用Python 2.7.我需要在wxpython中显示一个.png图像文件,这样可以保留透明度,并且您仍然可以看到图像的透明部分后面的控件.这需要在Windows,Mac和Linux上运行.
I'm using Python 2.7. I need to display a .png image file in wxpython, such that the transparency is preserved, and you can still see the controls behind the transparent part of the image. This needs to work in Windows, Mac, AND Linux.
推荐答案
我只是想添加如何正常绘制带有透明胶片的png,对于那些使用谷歌浏览并遇到此问题的人(就像我一样),所以他们最终没有思考由于接受了答案,所以不可能(就像我一样)
I just wanted to add how to draw a png with transparencies normally, for those who google and come across this (as I did) so they dont end up thinking its not possible because of the accepted answer (as I did)
import wx
dc = wx.PaintDC(self)
self.pngimage = wx.Bitmap('image.png', wx.BITMAP_TYPE_PNG)
dc.DrawBitMap(self.pngimage, x, y)
这就是我的工作,所有的透明胶片都可以完美显示.我正在使用wxpython 2.9.4.0
this is what I do, and all the transparencies are displayed perfectly. I'm using wxpython 2.9.4.0
这篇关于在wxpython中显示透明的.png的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!