2010-03-23 70 views
1

AuiNotebook頁面中可以放置AuiManager嗎?將AuiManager放入AuiNotebook頁面

已經用小樣本代碼進行了測試,但我只得到'分段錯誤'。

這是可能的開始?我想要這樣做的原因是將筆記本頁面分爲兩部分,並在兩部分的每個部分的頂部獲取字幕字段和最大化字段。一個簡單的splitterwindow可以工作,但看起來不那麼好,不能簡單地最大化。它也沒有標題字段。

下面的示例代碼。

import wx 
import wx.aui 

import wx.lib.inspection 

class MyFrame(wx.Frame): 
    def __init__(self, *args, **kwargs): 
     wx.Frame.__init__(self, *args, **kwargs) 

     self.mgr = wx.aui.AuiManager(self) 

     self.left = wx.Panel(self, -1, size = (200, 150)) 
     self.right = wx.aui.AuiNotebook(self, -1, size = (200, 150)) 
     self.bottom = wx.Panel(self, -1, size = (200, 150)) 

     self.mgr.AddPane(self.bottom, wx.aui.AuiPaneInfo().Bottom()) 
     self.mgr.AddPane(self.left, wx.aui.AuiPaneInfo().Left().Layer(1)) 
     self.mgr.AddPane(self.right, wx.aui.AuiPaneInfo().CenterPane()) 

     self.new_panel('Panel 1') 

     self.mgr.Update() 
     self.Update() 

    def new_panel(self, nm): 
     pnl = wx.Window(self) 
     pnl.identifierTag = nm 
     self.right.AddPage(pnl, nm, select = True) 
     self.sizer = wx.BoxSizer() 
     self.sizer.Add(self.right, 1, wx.EXPAND) 
     self.SetSizer(self.sizer) 
     pnl.SetFocus() 

     mgr = wx.aui.AuiManager(pnl) 

     left = wx.Panel(self) 
     right = wx.Panel(self) 

     mgr.AddPane(left, wx.aui.AuiPaneInfo().Left()) 
     mgr.AddPane(right, wx.aui.AuiPaneInfo().Right()) 

     mgr.Update() 

class MyApp(wx.App): 
    def OnInit(self): 
     frame = MyFrame(None, -1, '07_wxaui.py') 
     frame.Show() 
     self.SetTopWindow(frame) 
     return 1 

if __name__ == "__main__": 
    app = MyApp(0) 
    wx.lib.inspection.InspectionTool().Show() 

    app.MainLoop() 

回答