Display Bitmap image on Notebook

Hi all
Let me first state that i am new to wxPython.
I am making a GUI in which i have to display a bitmap which the user can select and the perform some drawing operations on it. I had posted a query earlier regarding this and Robin suggested that i use wxMemoryDC and load the bitmap using
dc.SelectObject(bitmap).
I did that and then used dc.Blit to display the image on a Notebook Page. This gives no errors, however the image is not displayed on the Notebook page. Also i used the wxMemoryDC and dc.Blit form within OnPaint function. What am i missing in the code. Is it even possible to display an image on a Notebook page. Do I need to used wxPaintDC, or wxClientDC to display the image on the Notebook.

Any Help is greatly appreciated

Ravpreet

···

---------------------------------
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

ravpreet bhamra wrote:

I am making a GUI in which i have to display a bitmap which the user
can select and the perform some drawing operations on it. I had
posted a query earlier regarding this and Robin suggested that i use
wxMemoryDC and load the bitmap using dc.SelectObject(bitmap). I did
that and then used dc.Blit to display the image on a Notebook Page.
This gives no errors, however the image is not displayed on the
Notebook page.

THis should work, however you may need to put a Panel on your Notebook page, and blit to that. Also, if you just need to draw a Bitmap to a DC, you can use DC.DrawBitmap(), it's easier than blitting.

Also i used the wxMemoryDC and dc.Blit form within
OnPaint function. What am i missing in the code. Is it even possible
to display an image on a Notebook page. Do I need to used wxPaintDC,
or wxClientDC to display the image on the Notebook.

You use a PaintDC ONLY within an OnPaint handler: when the System requests an update of the Window. If you are drawing at any other time, use a ClientDC. See:

http://wiki.wxpython.org/index.cgi/Frequently_20Asked_20Questions#head-5340d62fd2af0bd76e0aabb0443b0ceff96d05b8

In the Wiki. It's in the FAQ, if that long URL doesn't work for you.

http://wiki.wxpython.org/

Also look for the Drawing stuff in:

http://wiki.wxpython.org/index.cgi/RecipesImagesAndGraphics

If you still have problems, make a small sample and post it here.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov