display monochromatic images wxPython

W

wongjoekmeu

Dear All,
I want to write a GUI program with wxPython displaying an image. But
the image I have is monochromatic. When I retrieve the data from the
image I end up with a list of integer. Starting from a list of integer
and knowing the width and height of the image, how do I display such
an image on a wx panel or frame ? I have had a look at the wxPython
demo but there I see only images where the data is a list of tuple
consisting of r,g ,b values. Is there are function where I directly
can input the list of array and let it display the image ?
Thanks in advance

RR
 
M

Mike Driscoll

Dear All,
I want to write a GUI program with wxPython displaying an image. But
the image I have is monochromatic. When I retrieve the data from the
image I end up with a list of integer. Starting from a list of integer
and knowing the width and height of the image, how do I display such
an image on a wx panel or frame ? I have had a look at the wxPython
demo but there I see only images where the data is a list of tuple
consisting of r,g ,b values. Is there are function where I directly
can input the list of array and let it display the image ?
Thanks in advance

RR

You should be able to create a wx.StaticBitmap object and then set the
photo on it. Something like this:

<code>

# create a blank image holder
img = wx.EmptyImage(240,240)

self.myImageObj = wx.StaticBitmap(self, wx.ID_ANY,
wx.BitmapFromImage(img))
self.myImageObj.SetBitmap(wx.BitmapFromImage(img))

# refresh the widgets
self.Refresh() # where "self" is a wx.Frame

</code>

If that doesn't make sense or doesn't work in your case, please re-
post the question to the wxPython's User group:

http://wxpython.org/maillist.php

Mike
 
B

Bjoern Schliessmann

I want to write a GUI program with wxPython displaying an image.

Then be sure to check out the wxPython demo application. It displays
lots of images.

Regards,


Björn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,172
Latest member
NFTPRrAgenncy
Top