[wxPython-users] still can't figure out how to display images.

Christopher Barker Chris.Barker at noaa.gov
Tue Mar 27 09:28:24 PDT 2007


First read these:

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

Then consider: There are essentially two ways to display an image.

1) Using a wx.StaticBitmap
2) Drawing the image to a wx.Window (or wx.Panel) with a wx.DC.

The first is easier, the second gives you more control. For your =

purposes, a StaticBitmap is probably fine.

Enclosed is a little sample code that may help you figure it out. It =

doesn't seem to work with wxPython2.8 on OS-X, but it does work with =

wxPython2.6 -- I don't have time to debug it now, sorry.

> so I first need to know how I set the location of that image on the
> child frame and how I set the size.

The size is going to be the size of the image. If you need to re-size =

it, you can use wx.Image methods to do so. See the enclosed example.

The Location is set the same way as for any widget. Your best bet is to =

use Sizers. They take some doing to wrap your brain around, but it's =

worth it.

-Chris

PS: Please don't use MDI -- it's just my opinion, but I HATE all MDI =

apps, and even MS has abandoned it. It also doesn't work on any other =

platform. Check out wx.Aui for a much better option, or just use =

multiple top-level Frames.





-- =

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StaticBitmap.py
Type: text/x-python
Size: 2636 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20070=
327/2d6a2e93/StaticBitmap.py


More information about the wxpython-users mailing list