Problem with wxPython extension

Hello,

Wondering if someone can help me with this… I’m trying to write a wxPython extension module. I’ve tried just about everything with no luck. Here’s my setup:

Downloaded src distro from wxPython.org,

compiled wxWidgets src with vc7, monolithic unicode build.

compiled wxPython using setup.py, monolithic unicode build

created swig interface file, ran swig (-c++ -python -I… -o…) , compiled generated wrapper into my vc7 dll.

modified setup.py to include my build option which generates the appropriate .py and .pyd files.

When I try to import my library, I get the following:

import wx.m2u_base
Traceback (most recent call last):
File “”, line 1, in ?
File “c:\wxPython-src-2.6.1.0\wxPython\wx\m2u_base.py”, line 43, in ?
class mvpBaseCanvas(_windows.ScrolledWindow):
File “c:\wxPython-src-2.6.1.0\wxPython\wx\m2u_base.py”, line 46, in mvpBaseCanvas
for _s in [_windows.ScrolledWindow]: swig_setmethods.update(_s.swig_setmethods)
AttributeError: type object ‘ScrolledWindow’ has no attribute ‘__swig_setmethods
__’

Here’s my swig interface:

%module (package=“wx”) m2u_base

%{

#include “wx/wxPython/wxPython.h”

#include “wx/wxPython/pyclasses.h”

#include <wx/listctrl.h>

#include <wx/treectrl.h>

#include <wx/imaglist.h>

/* resolve tree dependency; we’re not referencing it anyway */

typedef wxTreeCtrl wxPyTreeCtrl;

#include “wx/wxPython/pytree.h”

#include “c:\projects\mvp\maestro_v3\include\wx\base\base_canvas.h”

%}

//---------------------------------------------------------------------------

%import windows.i

%import controls.i

%pythoncode { import wx }

MAKE_CONST_WXSTRING2(BaseCanvasControlNameStr,wxT(“baseCanvas”));

MAKE_CONST_WXSTRING_NOSWIG(EmptyString);

MustHaveApp(mvpBaseCanvas);

class mvpBaseCanvas: public wxScrolledWindow

{

public:

%pythonAppend mvpBaseCanvas "self._setOORInfo(self)"

%pythonAppend mvpBaseCanvas() ""

mvpBaseCanvas(wxWindow *parent, wxWindowID id=-1,

    const wxPoint& pos = wxDefaultPosition,

    const wxSize& size = wxDefaultSize,

    const unsigned styleBits = 0,

    long style = wxHSCROLL|wxVSCROLL,

    const wxString& name = wxPyBaseCanvasControlNameStr);

%RenameCtor(PreBaseCanvas, mvpBaseCanvas());

bool Create(wxWindow *parent, wxWindowID id=-1,

    const wxPoint& pos = wxDefaultPosition,

    const wxSize& size = wxDefaultSize,

    const unsigned styleBits = 0,

    long style = wxHSCROLL|wxVSCROLL,

    const wxString& name = wxPyBaseCanvasControlNameStr);

};

I would greatly appreciate any help,

Thanks in advance,

Michael

···

import wx
print dir(wx.ScrolledWindow)

shows that wx.ScrolledWindow doesn't have a __swig_setmethods__ attribute. Why do you have the for _s code? Is it generated by swig? Can you perhaps show a bit more of the context of the for _s loop?

···

Am Wed, 28 Sep 2005 15:07:41 -0400 hat Mike Heanssgen <MHeans@evertz.com> geschrieben:

Hello,

Wondering if someone can help me with this... I'm trying to write a
wxPython extension module. I've tried just about everything with no luck.
Here's my setup:

......

When I try to import my library, I get the following:

import wx.m2u_base

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "c:\wxPython-src-2.6.1.0\wxPython\wx\m2u_base.py", line 43, in ?
    class mvpBaseCanvas(_windows.ScrolledWindow):
  File "c:\wxPython-src-2.6.1.0\wxPython\wx\m2u_base.py", line 46, in
mvpBaseCanvas
    for _s in [_windows.ScrolledWindow]:
__swig_setmethods__.update(_s.__swig_setmethods__)
AttributeError: type object 'ScrolledWindow' has no attribute
'__swig_setmethods
__'