[Pythonmac-SIG] WxPython for MacPython

Just van Rossum just@letterror.com
Wed, 15 Mar 2000 10:43:13 +0100


At 12:25 AM +0100 15-03-2000, Jack Jansen wrote:
>I would strongly suggest using bgen in stead of SWIG, especially if
>you (or Robin) knows the header files well. Bgen is much harder to
>setup than SWIG, but once you've set it up it has two major
>advantages: (1) it knows everything about which C structures should be
>considered object types in Python and creates all those objects, with
>the functions operating on them as methods, the PyArg_ParseTuple glue
>routines to allow them to be passed as parameters to other calls,
>etc. and (2) if a new release of the underlying software comes out
>building a new Python module is usually catered for by re-running bgen.
>
>Without bgen the interfaces to the mac toolbox would have been
>unmaintainable. Every time apple adds 45 new calls to, say, quicktime,
>it takes me about 25 seconds to have them supported in Python. With
>SWIG you'd first have to create the .i files (although this can
>possibly be semi-automatic) and then you'd have to add all that Python
>glue code to create an OO interface to the lowlevel C interface.

While I understand what you're saying, I think in the case of wxPython this
may be bad advice: wxPython is already wrapped by SWIG on other platforms,
so it's probably a bad idea to use bgen for the Mac version since it won't
generate a compatible interface. (I actually don't see the point of
SWIG-ing it on the Mac: it's supposedly a cross platform library, so the
existing wrappers for other platforms should be usable as-is, no?)
Another issue is that wxWindows is C++ (?), and I'm not sure bgen handles
C++ at all... Yes, bgen generates superior code (nice OO wrappers at the
*C* level, without the need for those clumsy & inefficient shadow classes)
but if you've never worked with bgen before, it's a nightmare to set up.
No, there's no how-to, and actually there seems to be no doco, period...

Just