Search code examples
c++user-interfacewxwidgets

wxwidgets aui manager problem


i am using auimanager to show frame in a frame , however it keeps showing the second frame in a new window instead in the same window, or any other suggestions on how to do it ?


Solution

  • Your "outer frame" should be a aui.AuiMDIParentFrame, whereas the "inner frame" should be aui.AuiMDIChildFrame. In any case: post some code, then it is easier to advise.

    Example code:

    import wx
    import aui
    
    class MainFrame(aui.AuiMDIParentFrame):
        def __init__(self, parent):
            aui.AuiMDIParentFrame.__init__(self, parent, -1, title="AuiMDIParentFrame",
                                           size=(640, 480), style=wx.DEFAULT_FRAME_STYLE)
            child1 = InnerFrame(self, "child 1")
            child1.Show()
            child2 = InnerFrame(self, "child 2")
            child2.Show()
    
    
    class InnerFrame(aui.AuiMDIChildFrame):
        def __init__(self, parent, label):
            aui.AuiMDIChildFrame.__init__(self, parent, -1, title=label)
    
    if __name__ == "__main__":
        app = wx.PySimpleApp()
        frame = MainFrame(None)
        frame.CenterOnScreen()
        frame.Show()
        app.MainLoop()