Hi Gentlemen,
I have an error, which was non existant when i used wxpython 2.8.7.1. When i upgraded to 2.8.10.1, basically the GUI got messed up.I am using Python 2.52 environment.
The error seems to be from the fact that the parent, in this case
MyFrame(wx.aui.AuiMDIParentFrame), is the default frame, which means i did not have to have a wx.window passed as the argument, while, auimanager seems to look for a panel to attach too? Please take a look at the self running code below. Any comment is appreciated.
Thank you very much
import wx
import wx.aui
#----------------------------------------------------------------------
class MyFrame(wx.aui.AuiMDIParentFrame):
def __init__(self, parent):
wx.aui.AuiMDIParentFrame.__init__(self, parent, -1,
title="AuiMDIParentFrame",
size=(640,480),
style=wx.DEFAULT_FRAME_STYLE)
self.x=0
self._mgr = wx.aui.AuiManager(self)
self._mgr.AddPane(self.CreateTreeCtrl(), wx.aui.AuiPaneInfo().
Name("test8").Caption("BIST OVERVIEW").
Left().Layer(1).Position(1).CloseButton(True).
MaximizeButton(True))
self._mgr.AddPane(self.OnNewChild(), wx.aui.AuiPaneInfo().
Caption("HTML Content").
Float().FloatingPosition(self.GetStartPosition()).
FloatingSize(wx.Size(300, 200)).CloseButton(True).
MaximizeButton(True))
self._mgr.Update()
def CreateTreeCtrl(self):
self.tree = wx.TreeCtrl(self,-1,wx.Point(0,0),
wx.Size(130,100),
wx.TR_DEFAULT_STYLE|wx.NO_BORDER)
return self.tree
def OnNewChild(self):
child = ChildFrame(self,wx.DefaultPosition, wx.Size(400, 300))
child.Show()
def GetStartPosition(self):
self.x = self.x + 20
x = self.x
pt = self.ClientToScreen(wx.Point(0, 0))
return wx.Point(pt.x + x, pt.y + x)
#----------------------------------------------------------------------
class ChildFrame(wx.aui.AuiMDIChildFrame):
def __init__(self, parent, pos,size):
wx.aui.AuiMDIChildFrame.__init__(self, parent, -1,title='bist')
p = wx.Panel(self,-1)
wx.StaticText(p, -1, "This is child ")
p.SetBackgroundColour('light blue')
sizer = wx.BoxSizer()
sizer.Add(p, 1, wx.EXPAND)
self.SetSizer(sizer)
wx.CallAfter(self.Layout)
#----------------------------------------------------------------------#
class MainApp(wx.App):
def OnInit(self):
self.frame =MyFrame(None)
self.frame.Show(True)
self.frame.Maximize()
self.SetTopWindow(self.frame)
return True
if __name__ == '__main__':
app = MainApp(0)
app.MainLoop()