python swig

Hi all,
I would like to make a python gui toolkit based on FOX C++ Gui
toolkit. I had some basic knowledge in swig based on tutorials given
in the swig.org homepage. But my knowledge is not enough to make swig
files for a whole GUI toolkit.

So anyone please give me some links on making swig interface for
python.
Is there any good books for the making of swig interface. Treat me as
a newbie to swig.

Is there any users who develop swig interface for python gui based on c
++ gui toolkit like wxpython,pyQt etc.

Hi,

···

On Sep 21, 1:09 am, Mohammed Rashad <mohammedrasha...@gmail.com> wrote:

Hi all,
I would like to make a python gui toolkit based on FOX C++ Gui
toolkit. I had some basic knowledge in swig based on tutorials given
in the swig.org homepage. But my knowledge is not enough to make swig
files for a whole GUI toolkit.

So anyone please give me some links on making swig interface for
python.
Is there any good books for the making of swig interface. Treat me as
a newbie to swig.

Is there any users who develop swig interface for python gui based on c
++ gui toolkit like wxpython,pyQt etc.

Try the swig mailing list: SWIG Mailing Lists

They will know more about it then we will.

- Mike

Mohammed Rashad wrote:

I would like to make a python gui toolkit based on FOX C++ Gui
toolkit.

yup -- pretty OT, but...

I had some basic knowledge in swig based on tutorials given
in the swig.org homepage. But my knowledge is not enough to make swig
files for a whole GUI toolkit.

you're taking on a pretty major task! You may want to consider other tools, too. For instance, Cython is really nice, and getting much better for C++ work. Are there really no Python bindings for Fox yet? What about FxPy:

http://fxpy.sourceforge.net/

So anyone please give me some links on making swig interface for
python.
Is there any good books for the making of swig interface. Treat me as
a newbie to swig.

I don't think there is a book, SWIG is under-documented, I'm afraid.

Is there any users who develop swig interface for python gui based on c
++ gui toolkit like wxpython,pyQt etc.

wxPython is built with SWIG, so it is a great example of wrapping a large and complex library.

pyQT is built with SIP, which was built just for that -- it may be worth taking a look at too.

Robin, I'd be interested in hearing your opinion -- if you were starting from scratch, would you use SWIG at this point?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

In a nutshell SWIG takes C or C++ declarations and generates wrapper code for them that can be built as Python extension modules. There are also a ton of swig directives that let you have some control over how the code is generated, add additional things to the generated code, ignore some parts of the input, etc. If the headers for the library being wrapped are fairly clean and simple then you can just have SWIG read the same .h files. If you want to do some customization along the way then you can copy only those declarations that you care about to a *.i file that you can then feed to SWIG.

Read the SWIG Users Manual, there is lots of good information there and it will get you a long ways up the learning curve. Pay close attention to the chapters on SWIG Basics, C++, Typemaps, and Python. The experiment with it and read the generated code, especially for the features you don't understand yet. Once you get a good feel for how SWIG generates code then you can get to the point where you almost totally ignore the generated code and just focus on the input you give to SWIG.

···

On 9/20/10 11:09 PM, Mohammed Rashad wrote:

Hi all,
I would like to make a python gui toolkit based on FOX C++ Gui
toolkit. I had some basic knowledge in swig based on tutorials given
in the swig.org homepage. But my knowledge is not enough to make swig
files for a whole GUI toolkit.

So anyone please give me some links on making swig interface for
python.
Is there any good books for the making of swig interface. Treat me as
a newbie to swig.

Is there any users who develop swig interface for python gui based on c
++ gui toolkit like wxpython,pyQt etc.

--
Robin Dunn
Software Craftsman

SIP looks real good and has been getting less and less Qt specific over time so it can be useful for wrapping other libraries too. It also is focused only on generating Python bindings, not a dozen other languages too, so there isn't a lot of baggage. It has some good advantages over SWIG, but there are some things that SWIG can do that SIP can't (yet).

I really like the concepts behind Cython, although last I checked they are still missing some fairly big things needed for wrapping a large C++ hierarchy, such as being able to reflect virtual C++ method calls to Python methods in a derived class.

···

On 9/21/10 9:41 AM, Christopher Barker wrote:

Robin, I'd be interested in hearing your opinion -- if you were starting
from scratch, would you use SWIG at this point?

--
Robin Dunn
Software Craftsman