I changed the version of wxWidgets and wxPython to the latest from 2.8.12 and the application can’t start after that.
The problem:
self.m_Auinotebook is of type wx.aui.AuiNotebook .
The call :
self.m_Auinotebook.AddPage( self.m_panel6, u"Text", False, wx.Bitmap( u"res/text.png", wx.BITMAP_TYPE_ANY ) )
throws the exception:
<<<
File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_core.py”, line 13623, in AddPage
return _core_.BookCtrlBase_AddPage(*args, **kwargs)
TypeError: in method ‘BookCtrlBase_AddPage’, expected argument 5 of type ‘int’
swig/python detected a memory leak of type ‘wxPyXmlSubclassFactory *’, no destructor found.
I have found a similar case in this old message of 08.02.2012 (quoted at the end of this mail), so this was an old bug.
Another call brings the same result:
self.m_logsAuinotebook.AddPage( self.m_panel9, u"Log", False, wx.NullBitmap )
( The code is generated by wxFormBuilder. )
wxPython DEMO works only because instead of C++ version of aui it uses wxPython version:
import wx.lib.agw.aui as aui
So as workaround it is possible to replace :
import wx.aui
with:
#import wx.aui
import wx.lib.agw.aui as aui
wx.aui = aui
Are there any better solution?
Otherwise it is needed to patch the code generated by wxFormBuilder just to plaster this bug.
Thanks!
···
Big quote of an old mail:
<<<
Subject: Re: [wxPython-users] Re: GenericDatePickerCtrl crashes
[wxWidgets] 2.9.3.1 breaks the .AddPage method of AuiNotebook. The
statement:
self.auinbDataLists.AddPage( self.pnlAllVehicles, u"Vehicles",
False, wx.NullImage )
works in 2.9.2.4 but in 2.9.31 generates this exception:
TypeError: in method ‘BookCtrlBase_AddPage’, expected argument 5
of type ‘int’
If I eliminate that last argument (wx.NullImage), it works. (FYI,
I think FormBuilder creates the wx.NullImage argument.)
The AuiNotebook is now derived from BookCtrlBase instead of
reimplementing all the basic functionality itself. AddPage in
BookCtrlBase looks like this:
virtual bool AddPage(wxWindow *page,
const wxString& text,
bool select = false,
int imageId = -1);
There is still the AddPage in AuiNotebook like the following, but
apparently the one in the base class is taking precedence there…
bool AddPage(wxWindow* page,
const wxString& caption,
bool select = false,
const wxBitmap& bitmap = wxNullBitmap);
end of quote