[wxPython] Two-phase create with wxMDIParentFrame

RE: [wxPython] Two-phase create with wxMDIParentFrame
Here’s a short program than demonstrates what I’m curious about:

from wxPython.wx import *

class ezGUIApp(wxApp):

def OnInit(self):

    MainWindow = MainFrame(NULL)

    MainWindow.Show(TRUE)

    self.SetTopWindow(MainWindow)

    return TRUE

class MainFrame(wxMDIParentFrame):

def __init__(self, parent):

    wxMDIParentFrame.__init__(self, parent, -1, "Odd!")

    childFrame = self.GetClientWindow()

    childFrame.SetBackgroundColour(wxGREEN)

    cfw, cfh = childFrame.GetSizeTuple()

    cfx, cfy = childFrame.GetPositionTuple()

    print "Child before sizing", cfx, cfy, cfw, cfh

    childFrame.SetDimensions(100, 100, 100, 100, sizeFlags=0)

    cfw, cfh = childFrame.GetSizeTuple()

    cfx, cfy = childFrame.GetPositionTuple()

    print "Child after sizing", cfx, cfy, cfw, cfh

if name == ‘main’:

app = ezGUIApp(0)

app.MainLoop()

This is on Win2K and, obviously, you need to run this from a command prompt to see the messages

A child window exists as soon as the parent frame is created. It reports its size as 0 x 0 and you can change the size but it doesn’t seem to have the affect I would expect.

I’m sure I’ve misunderstood something. I’d just like to know what.

Thanks

Dale Strickland-Clark

Riverhall Systems Ltd. Custom database and Web applications.

Offices: London: 020 7448 9795 Wokingham: 0870 321 2378

Mobile 0701 071 DALE (3253)

···

-----Original Message-----

From: Robin Dunn [mailto:robin@alldunn.com]

Sent: Thu, 2002 January 10 18:10

To: wxpython-users@lists.wxwindows.org

Subject: Re: [wxPython] Two-phase create with wxMDIParentFrame

A frame with a size of zero by zero pixels.

-----Original Message-----

From: Robin Dunn [mailto:robin@alldunn.com]

Sent: Wed, 2002 January 09 18:07

To: wxpython-users@lists.wxwindows.org

Subject: Re: [wxPython] Two-phase create with wxMDIParentFrame

In fact, I’m still at a mystery about the purpose of the 0x0 frame

created

when you create the MDI parent frame. What’s it for? :slight_smile:

What do you mean by 0x0 frame?

Okay, you’ve lost me. Where are you seeing this? If it an extra frame

besides the MDIParent, or is that the one you are talking about?

Robin Dunn

Software Craftsman

robin@AllDunn.com Java give you jitters?

http://wxPython.org Relax with wxPython!


wxpython-users mailing list

wxpython-users@lists.wxwindows.org

http://lists.wxwindows.org/mailman/listinfo/wxpython-users

A child window exists as soon as the parent frame is created. It reports

its

size as 0 x 0 and you can change the size but it doesn't seem to have the
affect I would expect.

The GetClientWindow does not return a frame window, but window that is the
background of the MDI Parent (the thing that the child frames appear to be
above.) It is 0x0 because the parent frame hasn't been shown yet, so it
hasn't been resized to fill the client space. To make a child frame you
need to create a wxMDIChildFrame. See the MDIDemo.py in the demo directory
for an example.

···

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