[Pythonmac-SIG] Re: [MACTCL] Re: Python/Tkinter and QuickTimeTcl
Jim Ingham
jingham@apple.com
Thu, 21 Mar 2002 13:11:55 -0800
Jack,
I would have tried SWIG for the same purposes. It generates interfaces
for Perl, Python, Tcl/Tk, Guile, Ruby and a bunch of others from C &
C++. I haven't had opportunity to use it, but other people speak very
highly of it.
Did you have some bad experiences with it, or had you just not heard of
it, or did you mostly want to use a tool written in Python? If it is
either of the latter two, then for folks wanting to get quick access to
system functionality, going from C headers to Python interfaces to Tcl
seems overkill. It would be much easier to just run SWIG on the same
headers.
BTW - IMO, much of the time C interfaces are not a good match for the
interfaces you want from a scripting language - the design goals are
different. So this sort of autogeneration is mostly useful as a "first
cut" kind of thing. For instance, Tk is MUCH more useful than a
straight wrapped version of Carbon would be. Not sure whether this is
so true of AppKit since the API's are already at a pretty high level.
But I bet Tk would still in the end be more convenient... Similarly,
QuickTimeTcl adds a movie object that you create and manipulate, which
is not the way the C API's are written, but is more convenient from
Tcl...
Jim
On Thursday, March 21, 2002, at 12:41 PM, Jack Jansen wrote:
> [What follows now is a very biased opinion, if you read on you should
> bear in mind that I'm responsible for the stuff described here]
>
> In general I think that looking at whether functionality can be
> exported from Python to Tcl, especially for the Mac, may be a more
> interesting route. The MacOS toolbox modules for MacPython are almost
> all machine-generated: you feed in Universal Headers .h files on one
> end and out the other end come complete (or almost complete) glue
> modules. The package that does this, bgen, could probably be adapted to
> generate Tcl plugin modules in stead of Python plugin modules, but it
> would definitely take some real dedication to master it. But once
> you've mastered it it is great: I did an interface to most of
> CoreFoundation in a few evenings.
>
--
Jim Ingham jingham@apple.com
Developer Tools - gdb
Apple Computer