Hi Tony:
I normally put a panel on the frame, then in the panel's __init__() I read
the background image into a wx.Bitmap:
self.BgBitmap = wx.Bitmap(BgFilePath)
and bind a handler for the Erase Background event:
self.Bind(wx.EVT_ERASE_BACKGROUND, self._OnEraseBackground)
In the handler, just blit the bitmap onto the panel.
def _OnEraseBackground(self, Event):
# Get an Erase DC.
EraseDC = Event.GetDC()
# If it is null, use a Client DC instead.
if EraseDC is None:
EraseDC = wx.ClientDC(self)
# Blit the Background Bitmap over the Window.
MemoryDC = wx.MemoryDC()
MemoryDC.SelectObject(self.BgBitmap)
EraseDC.Blit(0, 0, self.BgBitmap.GetWidth(),
self.BgBitmap.GetHeight(), MemoryDC, 0, 0)
# Select out the Background Bitmap.
MemoryDC.SelectObject(wx.NullBitmap)
···
On Mon, Mar 24, 2008 at 9:01 PM, Tony Cappellini <cappy2112@gmail.com> wrote:
I'd like to display a background image for the main window, in my next program.
(The image will be faded to make it less visually disturbing using a
photo editing program.)I'm looking through the demo programs under the images section trying
to find a suitable example.
If I make a Static Bitmap as large as the main window, will I be able
to put other widgets on top of the bitmap (as if it were the main
Window),
and be able to respond to the events form those widgets?Or- dos someone have a better suggestion on how to do this?
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
--
Best Regards,
Michael Moriarity