image as wxMDIParentFrame background?

No, I did that also and forgot to mention it, so that's not the problem. The
App wouldn't have run if I had.
Kind of odd since wxMDIParentFrame inherits from wxFrame...

Thanks,

Bruce

···

-----Original Message-----
From: Cliff Wells [mailto:LogiplexSoftware@earthlink.net]
Sent: Friday, January 10, 2003 11:48 AM
To: 'wxPython-users@lists.wxwindows.org'
Subject: Re: [wxPython-users] image as wxMDIParentFrame background?

On Fri, 2003-01-10 at 10:39, brucedickey wrote:

Thank you Cliff. Your example worked.

I asked the question for what I hoped was the more general case. I assumed
that if it worked for wxFrame, that it would work for wxMDIParentFrame and
wxMDIChildFrame as well. This is (apparently) not the case. With the same
code except for

        wxMDIParentFrame.__init__(self, parent, id, title)

it does not work -- do you know what else needs to be done for
wxMDIParentFrame?

I can't really test MDI as I'm running Linux and there is no real MDI on
this platform. However, I have done exactly this in the past on an NT
box, so it should work. However, you'll need to change more than one
line. You have to derive from wxMDIParentFrame as well as calling its
__init__ method:

class MyFrame(wxMDIParentFrame):
    def __init__(self, parent, id, title):
        wxMDIParentFrame.__init__(self, parent, id, title)

Perhaps that was the problem?

-----Original Message-----
From: Cliff Wells [mailto:LogiplexSoftware@earthlink.net]
Sent: Friday, January 10, 2003 10:10 AM
To: 'wxPython-users@lists.wxwindows.org'
Subject: Re: [wxPython-users] wxPython: howto display image as wxFrame
background?

On Fri, 2003-01-10 at 08:28, brucedickey wrote:
> Hi, can this be done? Please post a short example. Thanks,

from wxPython.wx import *

class MyFrame(wxFrame):
    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, id, title)
        self.image = wxBitmap('/usr/share/pixmaps/XMMS1.png')
            
        EVT_PAINT(self, self.OnPaint)

    def OnPaint(self, event):
        self.Paint(wxPaintDC(self))

    def Paint(self, dc):
        dc.DrawBitmap(self.image, 0, 0)
        
class MyApp(wxApp):
    def OnInit(self):
        wxInitAllImageHandlers()
        self.frame = MyFrame(None, -1, "TITLE")
        self.frame.Show(true)
        self.SetTopWindow(self.frame)
        return true
    
app = MyApp(0)
app.MainLoop()

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Actually, come to think of it, it might be because wxMDIParentFrame is a
*scrolled* frame, so perhaps the bitmap is getting displayed, but not
where you think... try this and tell me if it works:

class MyFrame(wxMDIParentFrame):
    def __init__(self, parent, id, title):
        wxMDIParentFrame.__init__(self, parent, id, title)
        self.image = wxBitmap('/usr/share/pixmaps/XMMS1.png')
            
        EVT_PAINT(self, self.OnPaint)

    def OnPaint(self, event):
        dc = wxPaintDC(self)
        self.PrepareDC(dc)
        self.Paint(dc)

    def Paint(self, dc):
        dc.DrawBitmap(self.image, 0, 0)

···

On Fri, 2003-01-10 at 12:01, brucedickey wrote:

No, I did that also and forgot to mention it, so that's not the problem. The
App wouldn't have run if I had.
Kind of odd since wxMDIParentFrame inherits from wxFrame...

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308