I'm seeking a sample code to load a PNG image inside a wx.Panel, I've seen a couple of them using Python Imaging Library (PIL) and a hug bunch of code line.
I would like to keep my environment with as few library as possible, which means without PIL since I don't need to do any kind of image processing and I suppose that wx enable such processing.
Thanks
EDIT : code to achieve this from Mike's answer
image = wx.Image('path/to/image.png', wx.BITMAP_TYPE_ANY)
imageBitmap = wx.StaticBitmap(myPanel, wx.ID_ANY, wx.BitmapFromImage(image))
Then imageBitmap can be used as any other wx widget.
I wrote a really simple image viewer tutorial here that might help you: http://www.blog.pythonlibrary.org/2010/03/26/creating-a-simple-photo-viewer-with-wxpython/ It just uses wxPython, I think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With