I sightly modified the example program Andrea's website. Only thing
added is a toolbar. I get a segfault under Ubuntu 11 / x64 (wx version
2.8.11.0). Can you please confirm that this is a bug? Or maybe I did
something terribly wrong by adding some 5 lines of code?
Another thing I don't understand is that the wxPython demo uses the
"target" paramtere of the AuiManager.AddPane method. But if I try to
use it, I get and error telling:
TypeError: AddPane() got an unexpected keyword argument 'target'
How is that possible?
import wx
import wx.aui
class MyFrame(wx.Frame):
def __init__(self, parent, id=-1, title="AUI Test",
pos=wx.DefaultPosition,
size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self._mgr = wx.aui.AuiManager()
# notify AUI which frame to use
self._mgr.SetManagedWindow(self)
# create several text controls
text1 = wx.TextCtrl(self, -1, "Pane 1 - sample text",
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
text2 = wx.TextCtrl(self, -1, "Pane 2 - sample text",
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
text3 = wx.TextCtrl(self, -1, "Main content window",
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
# add the panes to the manager
tb = wx.aui.AuiToolBar(self, -1, wx.DefaultPosition,
wx.DefaultSize,
style=wx.aui.AUI_TB_DEFAULT_STYLE |
wx.aui.AUI_TB_OVERFLOW)
tb.SetToolBitmapSize(wx.Size(16, 16))
self._mgr.AddPane(tb, wx.aui.AuiPaneInfo().
Name("tb").Caption(u"Toolbar").ToolbarPane().Top())
self._mgr.AddPane(text1,
wx.aui.AuiPaneInfo().Left().Caption("Pane Number One").
MinimizeButton(True))
self._mgr.AddPane(text2,
wx.aui.AuiPaneInfo().Bottom().Caption("Pane Number Two"))
self._mgr.AddPane(text3, wx.aui.AuiPaneInfo().CenterPane())
# tell the manager to "commit" all the changes just made
self._mgr.Update()
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self, event):
# deinitialize the frame manager
self._mgr.UnInit()
self.Destroy()
event.Skip()
# our normal wxApp-derived class, as usual
app = wx.PySimpleApp()
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()