Hello,
I have a frame and I display a background image in it,
using the code below. This works fine. Now, as I
would like to add buttons and other widgets, I'm adding
a panel to the frame (see the line commented out at the
bottom of the script) and my picture image.jpg gets
reduce to a small square on the upper left side of the
frame.
What am I missing.
Thanks.
Raphael
···
--------------------------------------------------------------
# Background image class
class backgroundImage(wx.Window):
def __init__(self, parent, image):
wx.Window.__init__(self, parent)
self.image = image
self.Bind(wx.EVT_PAINT, self.OnBackgroundPaint)
def OnBackgroundPaint(self, event):
dc = wx.PaintDC(self.panel)
dc.DrawBitmap(self.image, 0, 0, True)
# Main frame class
class myFrame(wx.Frame):
def __init__(self):
self.backImg = wx.Bitmap("image,jpg", type = wx.BITMAP_TYPE_JPEG)
self.xSize = self.backImg.GetWidth()
self.ySize = self.backImg.GetHeight()
wx.Frame.__init__(self, None, -1, "EV", size=(self.xSize, self.ySize))
win = backgroundImage(self, self.backImg)
# panel = wx.Panel(self, -1)
class MyApp(wx.App):
etc...