I’m trying to create a wx.Bitmap from a downloaded jpeg file (stored at ‘link’). The following code works, but I’m having to write the response out to a file and then load the file into the bitmap. I’m hoping for a way to use the result from memory without having to go through a file.
Is there a way to do this?
Thanks
Eric
req_response = request.urlopen(link)
response = req_response.read()
im_file = open('foo.jpg', 'wb')
im_file.write(response)
im_file.close()
bitmap = wx.Bitmap()
bitmap.LoadFile('foo.jpg', wx.BITMAP_TYPE_ANY)