[wxPython-users] Displaying images

Christopher Barker Chris.Barker at noaa.gov
Thu Dec 27 10:59:33 PST 2007


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




-- =

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: test.py
Type: text/x-python
Size: 1836 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20071=
227/ccfdfea0/test.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: header.png
Type: image/png
Size: 9720 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20071=
227/ccfdfea0/header.png


More information about the wxpython-users mailing list