[wxPython] Bug in MDI child windows?

RE: [wxPython] Bug in MDI child windows?
This seems to be about as small as I can make it and still crash.

If you remove the LibraryFrame or the sash window in the StoryFrame, the problem does not occur.

from wxPython.wx import *

from wxPython.lib.anchors import LayoutAnchors

class GUIApp(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, 'Wibble MDI')

    self.SetMenuBar(wxMenuBar())

    x = LibraryFrame(self)

    y = StoryFrame(self)

class LibraryFrame(wxMDIChildFrame):

def __init__(self, parent):

    cx, cy = parent.GetClientSize()

    wxMDIChildFrame.__init__(self, parent, -1, 'Library', (0, 0), (200, cy-4), style=wxSTAY_ON_TOP)

class StoryFrame(wxMDIChildFrame):

def __init__(self, parent):

    wxMDIChildFrame.__init__(self, parent, -1, "Story", style=wxDEFAULT_FRAME_STYLE)

    self.BodyTextCtrl = wxTextCtrl(self, -1, style=wxTE_MULTILINE)

    EVT_SIZE(self, self.OnSize)

    pw, ph = self.GetClientSizeTuple()

    tp = wxSashLayoutWindow(self, -1, wxDefaultPosition,

                                      (pw, 80), style=wxCLIP_CHILDREN | wxSW_3D)

    tp.SetOrientation(wxLAYOUT_HORIZONTAL)

    tp.SetAlignment(wxLAYOUT_TOP)

    tp.SetSashVisible(wxSASH_BOTTOM, TRUE)

    tp.SetDefaultSize(wxSize(pw, 80))

def OnSize(self, event):

    wxLayoutAlgorithm().LayoutWindow(self, self.BodyTextCtrl)

if name == ‘main’:

app = GUIApp(0)

app.MainLoop()

I hope I’m not doing something dumb.

Thanks.

Dale Strickland-Clark

Riverhall Systems Ltd. Custom database and Web applications.

Offices: London & Wokingham

···

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

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

Sent: Fri, 2002 January 11 16:40

To: wxpython-users@lists.wxwindows.org

Subject: Re: [wxPython] Bug in MDI child windows?

The child window contains a wxSashLayoutWindow, which may be

relevant. Child windows without the sash seem OK.

Does it still crash if they havn’t been maximized?

No.

Send a sample then

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

This seems to be about as small as I can make it and still crash.

If you remove the LibraryFrame or the sash window in the StoryFrame, the
problem does not occur.

It doesn't crash for me...

class LibraryFrame(wxMDIChildFrame):
    def __init__(self, parent):
        cx, cy = parent.GetClientSize()
        wxMDIChildFrame.__init__(self, parent, -1, 'Library', (0, 0),

(200,

cy-4), style=wxSTAY_ON_TOP)

BTW, you might want to rethink this. It doesn't make much sense to have a
child frame if it's not going to look/act like a frame. Why not just use
another wxSashLayoutWindow for it? In the parent frame's EVT_SIZE handler
you can call wxLayoutAlgorithm().LayoutMDIFrame(self) and it will work just
like in the child frame.

···

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