[wxPython] c++ extension help?

Hi there, I am by no means extremely comfortable with c++ but I have
modified imagemagick's scale function to work on wximages directly and
was wondering, what is the right way to make that function accessible to
wxpython?

I basically have a new class that derives from wxImage that includes a
single new method imscale(). Do I need to use swig? Can anyone point me
at a good tutorial for something like this?

I guess I should mention, just in case, that the reason I did this is
that using PIL was/is too slow for large tiffs and attempting to redo my
app completely in c++ proved too much for my meager skills (in large
part due to the MUCH easier odbc modules available in python).

Thanks,

Mark Roach

Hi there, I am by no means extremely comfortable with c++ but I have
modified imagemagick's scale function to work on wximages directly and
was wondering, what is the right way to make that function accessible to
wxpython?

I basically have a new class that derives from wxImage that includes a
single new method imscale(). Do I need to use swig? Can anyone point me
at a good tutorial for something like this?

You don't necessarily need to use swig, but unfortunatly there is no
tutorial or how-to yet. I hope to have things better organized in this area
by the time 2.4 is released... Here are the basics:

1. Your extension module needs to include wxPython.h, currently found in the
wxPython/src directory.

2. You need to call wxPyCoreAPI_IMPORT() in your extension's init function.
This "imports" a C API from wxPython's core extension module. What actually
happens is that it sets a local pointer to a structure that exists in the
wxc module and is filled with pointers to functions. These functions are
helpers that assist with converting wxPython objects to/from wx C++ objects,
dealing with SWIG types, OOR, etc. There are a ton of macros defined in
wxPython.h that make it easy to call these functions through the function
pointer table. Most of the functions are located in
wxPython/src/helpers.cpp if you need more details.

3. Look at any of wxPython's SWIG-generated sources for examples of how to
create a wrapped function, convert types, etc.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

[snip]

Thanks very much, Robin. The amount and quality of help you dole out on
this list is always very impressive.

-Mark

···

On Wed, 2002-08-14 at 18:04, Robin Dunn wrote:

> Hi there, I am by no means extremely comfortable with c++ but I have
> modified imagemagick's scale function to work on wximages directly and
> was wondering, what is the right way to make that function accessible to
> wxpython?
>
> I basically have a new class that derives from wxImage that includes a
> single new method imscale(). Do I need to use swig? Can anyone point me
> at a good tutorial for something like this?

You don't necessarily need to use swig, but unfortunatly there is no
tutorial or how-to yet. I hope to have things better organized in this area
by the time 2.4 is released... Here are the basics: