Mike Stover
2014-10-01 18:13:39 UTC
I currently have a small program that is loading about 1 - 5 images into
memory using wx.FileSystem and wx.MemoryFSHandler. I would like to be able
to also remove these image from memory without closing the app and opening
it again. I won't post the full code unless asked for it, but here are the
important snippets.
In the wx.Frame class __init__:
*wx.FileSystem.AddHandler(wx.MemoryFSHandler())*
* self.theMemHandler = wx.MemoryFSHandler()*
In the function loading the images to memory:
*for image in self.image_list:*
* _image = self.process_image(image)*
* new_image = wx.EmptyImage(_image.size[0], _image.size[1])*
* new_image.SetData(_image.convert('RGB').tostring())*
* final_image = wx.BitmapFromImage(new_image)*
* self.theMemHandler.AddFile(image, final_image,
wx.BITMAP_TYPE_BITMAP)*
I do see a way of removing each image from memory by iterating over my
original list again and using *self.theMemHandler.RemoveFile()*, but I
would like to know if there is a better way.
Thanks,
- Mike S.
memory using wx.FileSystem and wx.MemoryFSHandler. I would like to be able
to also remove these image from memory without closing the app and opening
it again. I won't post the full code unless asked for it, but here are the
important snippets.
In the wx.Frame class __init__:
*wx.FileSystem.AddHandler(wx.MemoryFSHandler())*
* self.theMemHandler = wx.MemoryFSHandler()*
In the function loading the images to memory:
*for image in self.image_list:*
* _image = self.process_image(image)*
* new_image = wx.EmptyImage(_image.size[0], _image.size[1])*
* new_image.SetData(_image.convert('RGB').tostring())*
* final_image = wx.BitmapFromImage(new_image)*
* self.theMemHandler.AddFile(image, final_image,
wx.BITMAP_TYPE_BITMAP)*
I do see a way of removing each image from memory by iterating over my
original list again and using *self.theMemHandler.RemoveFile()*, but I
would like to know if there is a better way.
Thanks,
- Mike S.
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.