0
是否可以将其转换为位图或图标? 我想避免将它保存在文件中,例如用wx.Bitmap读取它。如何在wxpython中使用GdkPixbuf?
是否可以将其转换为位图或图标? 我想避免将它保存在文件中,例如用wx.Bitmap读取它。如何在wxpython中使用GdkPixbuf?
这似乎工作:
import wx
import gtk
pb = gtk.gdk.pixbuf_new_from_file("someFile.jpg")
img = wx.EmptyImage(pb.get_width(), pb.get_height())
img.SetData(pb.get_pixels())
## you can now convert the wx.Image to wx.Bitmap etc...
感谢答案..但一两件事。为什么PB长度是4096,IMG是3072,所以我得到不同大小的错误?是与阿尔法? – xliiv 2011-05-30 15:03:10