thank you for your fast reply.
Please take a look at the code below. It works on wxpython 2.8.7.1
using python2.5, on WinXP, but not wxpython package 2.8.10.1
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?
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()
> Software Craftsmanhttp://wxPython.org- Hide quoted text -
>
> - Show quoted text -
For the code as follows, i get an error
"wxAuiManager::AddPane(): NULL window ptrs are not allowed" when run
on python 2.5.4 & wxpython 2.8.10.1
The standalone code below runs without problem on wxpython 2.8.7.1
using python2.5.4, on WinXP, but not wxpython package 2.8.10.1
I got some remarks that it could be a bug, but i would just like to
double check if anyone in the group has an idea on this failure
Rgds,
Devendran
#aui_trial.py
On Dec 21, 2009, at 12:46 AM, Devendran wrote:
> Hi,
>
> For the code as follows, i get an error
> "wxAuiManager::AddPane(): NULL window ptrs are not allowed" when run
> on python 2.5.4 & wxpython 2.8.10.1
>
> The standalone code below runs without problem on wxpython 2.8.7.1
> using python2.5.4, on WinXP, but not wxpython package 2.8.10.1
>
> I got some remarks that it could be a bug, but i would just like to
> double check if anyone in the group has an idea on this failure
Yes its a bug, but the bug is in your code.
>
> self._mgr.AddPane(self.OnNewChild(), wx.aui.AuiPaneInfo().
> Caption("HTML Content").
> Float().FloatingPosition
> (self.GetStartPosition()).
> FloatingSize(wx.Size(300, 200)).CloseButton
> (True).MaximizeButton(True))
Here you are adding a pane by calling OnNewChild
>
> def OnNewChild(self):
> child = ChildFrame(self,wx.DefaultPosition, wx.Size(400,
> 300))
> child.Show()
This returns None, it should return child (which needs to be a valid
window object)
Cody