Problem with wxPython extension

The _s context is in the class mvpBaseCanvas(_windows.ScrolledWindow)
statement below. This is the .py file generated by SWIG. Possible that I
am missing a command line option? Or not importing correctly?

# This file was created automatically by SWIG.
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.

import _m2u_base

def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
    if (name == "this"):
        if isinstance(value, class_type):
            self.__dict__[name] = value.this
            if hasattr(value,"thisown"): self.__dict__["thisown"] =
value.thisown
            del value.thisown
            return
    method = class_type.__swig_setmethods__.get(name,None)
    if method: return method(self,value)
    if (not static) or hasattr(self,name) or (name == "thisown"):
        self.__dict__[name] = value
    else:
        raise AttributeError("You cannot add attributes to %s" % self)

def _swig_setattr(self,class_type,name,value):
    return _swig_setattr_nondynamic(self,class_type,name,value,0)

def _swig_getattr(self,class_type,name):
    method = class_type.__swig_getmethods__.get(name,None)
    if method: return method(self)
    raise AttributeError,name

import types
try:
    _object = types.ObjectType
    _newclass = 1
except AttributeError:
    class _object : pass
    _newclass = 0
del types

import _windows
import _core
import _controls
import wx
class mvpBaseCanvas(_windows.ScrolledWindow):
    """Proxy of C++ mvpBaseCanvas class"""
    __swig_setmethods__ = {}
    for _s in [_windows.ScrolledWindow]:
__swig_setmethods__.update(_s.__swig_setmethods__)
    __setattr__ = lambda self, name, value: _swig_setattr(self,
mvpBaseCanvas, name, value)
    __swig_getmethods__ = {}
    for _s in [_windows.ScrolledWindow]:
__swig_getmethods__.update(_s.__swig_getmethods__)
    __getattr__ = lambda self, name: _swig_getattr(self, mvpBaseCanvas,
name)
    def __repr__(self):
        return "<%s.%s; proxy of C++ mvpBaseCanvas instance at %s>" %
(self.__class__.__module__, self.__class__.__name__, self.this,)
    def __init__(self, *args):
        """
        __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize, unsigned int styleBits=0,
            long style=wxHSCROLL|wxVSCROLL, String
name=BaseCanvasControlNameStr) -> mvpBaseCanvas
        __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize, unsigned int styleBits=0,
            long style=wxHSCROLL|wxVSCROLL) -> mvpBaseCanvas
        __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize, unsigned int styleBits=0) ->
mvpBaseCanvas
        __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize) -> mvpBaseCanvas
        __init__(self, Window parent, int id=-1, Point pos=DefaultPosition)
-> mvpBaseCanvas
        __init__(self, Window parent, int id=-1) -> mvpBaseCanvas
        __init__(self, Window parent) -> mvpBaseCanvas
        """
        _swig_setattr(self, mvpBaseCanvas, 'this',
_m2u_base.new_mvpBaseCanvas(*args))
        _swig_setattr(self, mvpBaseCanvas, 'thisown', 1)
        self._setOORInfo(self)

    def Create(*args):
        """
        Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize, unsigned int styleBits=0,
            long style=wxHSCROLL|wxVSCROLL, String
name=BaseCanvasControlNameStr) -> bool
        Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize, unsigned int styleBits=0,
            long style=wxHSCROLL|wxVSCROLL) -> bool
        Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize, unsigned int styleBits=0) -> bool
        Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
            Size size=DefaultSize) -> bool
        Create(self, Window parent, int id=-1, Point pos=DefaultPosition) ->
bool
        Create(self, Window parent, int id=-1) -> bool
        Create(self, Window parent) -> bool

        Create the GUI part of the Window for 2-phase creation mode.
        """
        return _m2u_base.mvpBaseCanvas_Create(*args)

    def __del__(self, destroy=_m2u_base.delete_mvpBaseCanvas):
        """__del__(self)"""
        try:
            if self.thisown: destroy(self)
        except: pass

class mvpBaseCanvasPtr(mvpBaseCanvas):
    def __init__(self, this):
        _swig_setattr(self, mvpBaseCanvas, 'this', this)
        if not hasattr(self,"thisown"): _swig_setattr(self, mvpBaseCanvas,
'thisown', 0)
        _swig_setattr(self, mvpBaseCanvas,self.__class__,mvpBaseCanvas)
_m2u_base.mvpBaseCanvas_swigregister(mvpBaseCanvasPtr)
cvar = _m2u_base.cvar
BaseCanvasControlNameStr = cvar.BaseCanvasControlNameStr

def PreBaseCanvas(*args):
    """PreBaseCanvas() -> mvpBaseCanvas"""
    val = _m2u_base.new_PreBaseCanvas(*args)
    val.thisown = 1
    return val

···

-----Original Message-----
From: Nitro [mailto:nitro@dr-code.org]
Sent: Wednesday, September 28, 2005 3:38 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Problem with wxPython extension

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
__'

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?

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hmm, there are some switches you should try, my best idea is currently the "-modern" switch. Take a look at the options Robin uses for the default wx build and compare them with yours. To me this seems like different command line options.

···

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

The _s context is in the class mvpBaseCanvas(_windows.ScrolledWindow)
statement below. This is the .py file generated by SWIG. Possible that I
am missing a command line option? Or not importing correctly?