Displaying images

mawe wrote:

My thought was just adding the image to the top sizer
but that doesn't work.

It should have.

Isn't there a way to simply add the image to one of my sizers,

yes.

  and

simply define height and width of it so that the sizer takes up the
mininum space to fully display the image?

a wx.StaticBitmap will scale itself to the image you give it.

The wxPython demos seem to use
wx.Panel for that or at least it looks like it.

You probably do want to put all this on a wx.Panel, rather than straight on the Frame, but it should work as is.

A few comments:

You've go t a lot of sizers in there -- yo may be preparing for a more complex layout but you don't need nearly that many now. start simple and add as you go. You might also want to look at:

wx.GridSizer
wx.FlexGridSizer
wx.GridBagSizer

which may make your layout easier.

Also, do check out:

http://wiki.wxpython.org/wxPython_Style_Guide

It will give you some good ideas how to write more readable code.

All that being said, enclosed is a version that works, Note that:

  self.topSizer
  self.middleSizer
  self.bottomSizer

Are unnecessary, but I left them in, in case you were planning on doing more with them.

-Chris

test.py (1.79 KB)

header.png

···

--
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@noaa.gov