wxPython MDI question
rockmuelle
cmueller at onebox.com
Fri Feb 22 11:50:28 EST 2002
Ok, found some code for this hidden in the demo directory.
wxPython/demo/MDISashDemo.py shows how to do it.
-Chris
cmueller at onebox.com (rockmuelle) wrote in message news:<aaa059f1.0202211632.1f9e9d98 at posting.google.com>...
> I am trying to create an MDI application that has a list control on
> the left side of the main MDI frame and the MDI client area on the
> right side, similar to the way Visual Studio has other windows
> surrounding its client area.
>
> I've tried creating the list control and then adding it and the client
> area to a sizer, but the client area always takes up the whole main
> frame. The client area and the list control are situated at (0, 0), as
> if there was no sizer. If I add more controls to the sizer, the
> non-client area windows get layed out correctly, but the sizer and
> client area still overlap.
>
> Does anyone know how to fix this?
>
> I'm using wxPython 2.3.1 with Python 2.1.1 on Windows 2K. Code
> demonstrating what I've tried is appended to this message.
>
> Thanks.
>
> -Chris
>
>
> from wxPython.wx import *
>
> class MyMDIFrame(wxMDIParentFrame):
> """
> Main frame that has list control and MDI client area.
> """
>
> def __init__(self, parent, id=-1, title='MDI Example'):
> wxMDIParentFrame.__init__(self, parent, id, title=title)
>
> sizer = wxBoxSizer(wxHORIZONTAL)
> sizer.Add(wxListCtrl(self, -1))
> sizer.Add(wxListCtrl(self, -1)) # add another list
> sizer.Add(self.GetClientWindow())
> sizer.Layout()
>
> self.SetSizer(sizer)
> self.Fit()
>
> return
>
>
> if __name__=="__main__":
>
> class App(wxApp):
>
> def OnInit(self):
> frame = MyMDIFrame(NULL)
> frame.Show(true)
> self.SetTopWindow(frame)
>
> return true
>
> app = App(0)
> app.MainLoop()
More information about the Python-list
mailing list