Can ControlImage take data instead of a filename?
#1
i'm capturing a screenshot on my pc, via a python server, then streaming that image to my xbox, which receives it, displays it, and throws it away, just to receive a new image.

the sad thing is, i'm having to write that image to a file on the xbox (which process isn't working smoothly yet), read the file into controlimage, and then delete the file. not at all elegant.

tkinter's photoimage has an optional arg "data" that looks like this:
Quote:self.pic = photoimage(data = base64.encodestring(simage))
this photoimage object is fairly similar to the controlimage object (it's usually written photoimage(file = filename), and the use of "data" here is a very convenient exception). i was just wondering how hard it would be for us to get a function like controlimage that is passed the contents of an image file, rather than the filename? because i'd really prefer not to have to reload to memory an object that i've already got opened....

right now, that code looks like this:
Quote:filename = cachedir + comm.recv(self.sock)
simage = comm.recv(self.sock)
ffile = file(filename, "wb")
ffile.write(simage)
ffile.close()
self.pic = xbmcgui.controlimage(20,20,600,440, filename)
self.addcontrol(self.pic)
os.remove(filename)
i think it could be as simple as:
Quote:simage = comm.recv(self.sock)
self.pic = xbmcgui.controlimagefromdata(20,20,600,440, simage)
self.addcontrol(self.pic)
For scripts, script development tools, and documentation, visit my website:
http://www.maskedfox.com/xbmc/
Reply

Logout Mark Read Team Forum Stats Members Help
Can ControlImage take data instead of a filename?0