error using wx.AuiManager

31 views
Skip to first unread message

Devendran

unread,
Dec 16, 2009, 6:38:59 AM12/16/09
to wxPython-users
Hi Gentlemen,

I have a code that was running fine with wxpython 2.8.4.0
But when i upgraded wxpython to 2.8.10.1
I had an issue with adding pane(s)
Everything works fine when i revert back to the previous version
I tried searching in the archives, but came up short.
I hope some one could give me a pointer on the error below

error as follows:

Traceback (most recent call last):
File "OMS_MULTI.py", line 1673, in <module>
app=MainApp(0)
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 7978
, in __init__
self._BootstrapApp()
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 7552
, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "OMS_MULTI.py", line 1665, in OnInit
self.frame =MyFrame(None)
File "OMS_MULTI.py", line 357, in __init__
FloatingSize(wx.Size(300, 200)).CloseButton(True).MaximizeButton
(True))
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\aui.py",
line 752, i
n AddPane
return self._AddPane1(window, info)
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\aui.py",
line 621, i
n _AddPane1
return _aui.AuiManager__AddPane1(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "window" failed at ..\..\src
\aui\framem
anager.cpp(942) in wxAuiManager::AddPane(): NULL window ptrs are not
allowed

Rgds,
Devendran

Robin Dunn

unread,
Dec 16, 2009, 3:52:52 PM12/16/09
to wxpytho...@googlegroups.com
You are probably passing None where a window object is expected. Look
around line 357 in OMS_MULTI.py


--
Robin Dunn
Software Craftsman
http://wxPython.org

Devendran

unread,
Dec 17, 2009, 2:11:48 AM12/17/09
to wxPython-users
hi Robin,

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 -

Devendran

unread,
Dec 21, 2009, 1:46:22 AM12/21/09
to wxPython-users
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

Rgds,
Devendran

#aui_trial.py

Cody Precord

unread,
Dec 21, 2009, 3:06:56 AM12/21/09
to wxpytho...@googlegroups.com
Hi,

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


Reply all
Reply to author
Forward
0 new messages