473,748 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

display monochromatic images wxPython

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
Jun 27 '08 #1
3 1497
On Apr 25, 3:42*pm, "wongjoek...@ya hoo.com" <wongjoek...@ya hoo.com>
wrote:
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(2 40,240)

self.myImageObj = wx.StaticBitmap (self, wx.ID_ANY,
wx.BitmapFromIm age(img))
self.myImageObj .SetBitmap(wx.B itmapFromImage( 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
Jun 27 '08 #2
On Fri, 25 Apr 2008 14:42:17 -0700, wo*********@yah oo.com wrote:
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
I think that RGB colors with the same amount of R,G, and B levels always
result in some shade of gray. If so, you could try building your image
data by convering each numver in a triplet of equal numbers.

Ciao
----
FB
Jun 27 '08 #3
wo*********@yah oo.com wrote:
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

--
BOFH excuse #217:

The MGs ran out of gas.

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7620
by: Jonathan Daugherty | last post by:
Does anyone here know if the wxImage class in wxPython supports dislaying images from URLs? -- Jonathan Daugherty http://www.cprogrammer.org "It's a book about a Spanish guy called Manual, you should read it." -- Dilbert
6
1800
by: matthiasjanes | last post by:
Dear everyone, I would like to know what would be the smalles possible WebBrowser for displaying Python CGI application. I developed a few small application with an WebInterface. The appplication runs just locally. I use CGIHTTPServer.py Module as a small webserver and Mozilla
2
16926
by: Mathias | last post by:
Dear NG, I currently ty to switch from matlab to python/scipy but have a lot of trouble with images. What I need is a function for subsequently displaying a number of 2D-matrices as an image. I tried: - Image.show() which is nice but slow and I don't seem to be able to either close the window nor draw again to the same window, so I end up with 100 pictures on the screen... - scipy.xplt.imagesc() and scipy.plt.imagesc() crash
2
3179
by: dr_tyson | last post by:
I am trying to embed images into a wxPython app (created using Boa Constructor), but have not been able to do so. I know how to embed plots, but images seem to be a problem. I've tried using code analogous to the example given at the Matplotlib website to no avail. If anybody has been successful at this could you please post some sample code? That would be greatly appreciated. Thanks! Randy
10
3985
by: Guenter | last post by:
Hi, I need to develop an application that displays video 640x480 16-bit per pixel with 30 fps. I would prefer to do that with Python (wxPython) but don't have any experience whether it is possible to achieve that frame rate and still have some resources for other processing left? My development PC would be a Celeron 1 GHz. The final system could be a faster system.
3
6260
by: David | last post by:
I would like to display a JPEG image from Python on a Windows machine. I Googled 'python jpeg display' and have not found what I am looking for, which is code I can call directly and pass the image. I see the PIL library lets me do all sorts of image manipulation, but is there a convenient way to display results? I guess I could issue shell commands to a graphics display package such as IrfanView, but I thought there might be a cleaner...
0
951
by: Erik | last post by:
Is it possible with wxPython to place images in a textctrl (or a styledtextctrl)? If you don't get what I mean, just think about emoticons in the MSN messenger chat window. So is it possible to use images in a textCtrl? Thanks Erik
2
1915
by: jimmygyuma | last post by:
Windows XP Media Center - Python 2.5 - wxPython 2.8 Code ... bmp = wx.Image("images\\new24.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap() print str(bmp.GetWidth()) self.fileNewItem = fileMenu.Append(-1, "New ...", "Create new image") self.fileNewItem.SetBitmap(bmp) bmp = self.fileNewItem.GetBitmap() print str(bmp.GetWidth()) self.Bind(wx.EVT_MENU, self.OnFileNew, self.fileNewItem)
2
2857
tharden3
by: tharden3 | last post by:
Ok, I've been going through these tutorials for both PyGame and wxPython, but I've hit a big speed bump. In each tutorial, I've gotten to the point where I need to "import" or "load" images for various purposes (animation, icons, etc.). Each time I follow the tutorial, I can't quite get it right... please don't tell me "Hey, you can't use the pictures in the tutorial example because those are not the directories, paths, or pics that are on your ...
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.