Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文件picture.jpg,我正在把它读到内存中
f = open('picture.jpg', 'rb') pic = f.read() f.close()
如何将 pic 转换为 gtk.gdk.Pixbuf?我知道有 gdk_pixbuf_new_from_stream() 但它似乎从 pyGTK 中丢失:/
您可以使用Pixbuf加载器:
Pixbuf
loader = gtk.gdk.PixbufLoader('jpeg') loader.write(pic) loader.close() pixbuf = loader.get_pixbuf()