Centre image in wx.StaticBitmap

I have a simple image viewer program which is part of a larger
application. Images are rendered into a wx.StaticBitmap which in turn
lives in a wx.Panel:

        self.panel = wx.Panel(id=wxID_PICVIEWPANEL, name='panel',
parent=self,
              pos=wx.Point(0, 35), size=wx.Size(800, 565),
style=wx.TAB_TRAVERSAL)
        self.panel.SetBackgroundColour(wx.Colour(0, 0, 0))
        self.panel.SetToolTipString('')

        self.bitMap = wx.StaticBitmap(bitmap=wx.NullBitmap,
id=wxID_PICVIEWBITMAP,
              name='bitMap', parent=self.panel, pos=wx.Point(0, 35),
              size=wx.Size(800, 565), style=wx.CLIP_CHILDREN)
        self.bitMap.SetBackgroundColour(wx.Colour(0, 0, 0))
        wx.EVT_LEFT_DCLICK(self.bitMap, self.OnStaticbitmap1LeftDclick)

As you will see, the StaticBitmap defaults to a size of 800x565. When I
try to render a 640x480 image (or any image smaller than the
StaticBitmap widget for that matter) using:

        img = wx.Image('/path/to/some/image/file')
        self.bitMap.SetBitmap(img.ConvertToBitmap())

I find that on Windows, the image appears in the centre of the
StaticBitmap widget without my having to do anything, which is what I
want.

Under Linux (specifically Python 2.3.3 and
wxPython2.5-gtk2-unicode-2.5.3.1-1_py2.3 from RPM) the image is rendered
at the top left corner. Does StaticBitmap have a method I can call to
make it centre the image? I've looked through the latest wx2.5 docs, but
can't find anything that looks like it might help.

···

--

Regards

Phil Edwards
Brighton, UK

Thanks, Robin, I'll have a play with that and see what I can come up
with.

···

On Thu, 2005-02-10 at 22:24, Robin Dunn wrote:

> at the top left corner. Does StaticBitmap have a method I can call to
> make it centre the image?

No but you should be able to easily make your own class that does this.
  See wx/lib/statbmp.py for a good starting place.

--

Regards

Phil Edwards
Brighton, UK