7

I have a picture in memory a format (output from pyplot) and I want to directly show it on the Android through Kivy, but I don't want to create a picture file. Is there any way to do this? On pyplot I am able to generate the file like object by writing it the object, but I don't know how to put it into Kivy.

4

3 に答える 3

2

StringIO を使用してファイルをバッファーに保存できます (これを参照してください: Binary buffer in Python )。

何かのようなもの:

from StringIO import StringIO
buff = StringIO()
plt.savefig(buff)
buff.seek(0)
from kivy.core.image.img_pygame import ImageLoaderPygame
imgdata = ImageLoaderPygame(buff)._data
于 2012-05-26T00:09:51.760 に答える