image as wxMDIParentFrame background?

Found the following in the documentation as applies to C++. Doesn't work in
wxPython; that is the overridden wxMDIParentFrame::OnCreateClient() is never
called (as the text says). Robin, is there a way to do this two-stage
creation in Python or other way to get control over the creation of the
wxMDIClientWindow? Or alternately, a way to get the DC from the client
window (GetDC(), wxPaintDC(), wxClientDC() are not implemented)?

Thanks,

Bruce

wxMDIParentFrame::OnCreateClient
virtual wxMDIClientWindow* OnCreateClient()

Override this to return a different kind of client window. If you override
this function, you must create your parent frame in two stages, or your
function will never be called, due to the way C++ treats virtual functions
called from constructors. For example:

  frame = new MyParentFrame;
  frame->Create(parent, myParentFrameId, wxT("My Parent Frame"));

Remarks

You might wish to derive from wxMDIClientWindow in order to implement
different erase behaviour, for example, such as painting a bitmap on the
background.

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Monday, January 13, 2003 7:34 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] image as wxMDIParentFrame background?

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?

The problem with the wxMDIParentFrame is that it already has a child
window to fill all the area behind the wxMDICHildFrames. You can get a
reference to it with GetClientWindow() and then perhaps installing an
EVT_ERASE_BACKGROUND handler for it will work.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

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

brucedickey wrote:

Found the following in the documentation as applies to C++. Doesn't work in
wxPython; that is the overridden wxMDIParentFrame::OnCreateClient() is never
called (as the text says). Robin, is there a way to do this two-stage
creation in Python or other way to get control over the creation of the
wxMDIClientWindow? Or alternately, a way to get the DC from the client
window (GetDC(), wxPaintDC(), wxClientDC() are not implemented)?

Right, that virtual is not reflected into Python, but you can still do stuff with the window. For example, I just did this in PyShell:

>>> from wxPython.wx import *
>>>
>>> f = wxMDIParentFrame(None, -1, "Test")
>>> f.Show()
1
>>> f.GetClientWindow().SetBackgroundColour("BLUE")
>>> f.GetClientWindow().Refresh()
>>>

You can also set event handlers using the client window as the target, etc.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!