Hi, I am attempting to write a wxPython/OSG application but I'm having
difficulty with classes that must inherit from both packages. Following
an OSG C++ example I define a class below:
class CallbackGLCanvas(wxGLCanvas,osgViewer.GraphicsWindow):
def __init__(self,
parent,renderables,attribList=[GL_DOUBLEBUFFER,0],size=wx.Size(-1,-1)):
wxGLCanvas.__init__(self, parent,
-1,attribList=attribList,style=wx.NO_BORDER,size=size)
# ...
This generates the following runtime error:
Traceback (most recent call last):
File "../python/example_viewer.py", line 138, in <module>
main()
File "../python/example_viewer.py", line 118, in main
app = wxViewer.ViewerApp( ) # Enables the GL Context.
File "/local/abe/OSGProject/python/wxViewer.py", line 288, in __init__
self.frame = ViewerFrame( renderSize )
File "/local/abe/OSGProject/python/wxViewer.py", line 53, in __init__
size=renderSize )
File "/local/abe/OSGProject/python/CallbackGLCanvas.py", line 37, in
__init__
size=size)
File
"/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/glcanvas.py",
line 143, in __init__
self.thisown = 1
File
"/local/abe/build-piglet/package/osgBindings/build-Debug/lib/osgViewer.py",
line 154, in <lambda>
__setattr__ = lambda self, name, value: _swig_setattr(self,
GraphicsWindow, name, value)
File
"/local/abe/build-piglet/package/osgBindings/build-Debug/lib/osgViewer.py",
line 22, in _swig_setattr
return _swig_setattr_nondynamic(self,class_type,name,value,0)
File
"/local/abe/build-piglet/package/osgBindings/build-Debug/lib/osgViewer.py",
line 9, in _swig_setattr_nondynamic
if (name == "thisown"): return self.this.own(value)
AttributeError: 'PySwigObject' object has no attribute 'own'
It looks like the setattr method in the swig wrapped osg code is being
used instead of the setattr function from swig wrapped wx.
Can anyone help guide me through how this is supposed to work (assuming
multiple inheritance is actually supposed to work in this sort of
situation)?
Thanks-
Abe