This shows how to build a wxPython extension using Visual Studio in a stand-alone project. These instructions describe experiences with wxPython 2.6.1.0 and the patched swig 1.3.24. As things get easier with newer versions of wxPython and swig, please leave the existing parts of the page, and add the newer information.

For the recommended method of extending wxPython with distutils, placing your source in the wxPython source tree please see: the C++Extenions page, and if you're curious how to use Scons to build a wxPython extension see the SconsExtensions page.

Why Bother?

Getting Robin's wxPython build files

Get SWIG, the Simple Wrapper Interface Generator

Writing a C++ wxWidgets class

Create the SWIG interface file

/*** tileCache.i ***************************************************
*/
%{
#include "wx/wxPython/wxPython.h"
#include "imaging/big/tileCache.h"
%}
%import core.i
%pythoncode { import wx }
%pythoncode { __docfilter__ = wx._core.__DocFilter(globals()) }
class TileCache: public TileFilter
{
public:
    TileCache();
    // Notice:  No wrapper for the destructor
    void SetCacheSize(int size);
    virtual wxImage GetTile(unsigned int tilex, unsigned int tiley);
};
/* end of tileCache.i */

Visual Studio build environment

References

VisualStudioExtensions (last edited 2008-03-11 10:50:18 by localhost)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.