Re: GTK+ and (perl or python)?



On Sat, Feb 12, 2005 at 07:10:33AM +0100, Xavier Ordoquy wrote:
> On Fri, 2005-02-11 at 19:01 -0800, Ben Johnson wrote:
> > Hey.
> 
> > I'm thinking about using python instead though because I hear adding
> > callbacks in C to python handler code is relatively simple.  (it's about
> > time I learned python anyway.)  I don't know if a python state is
> > maintained for all callbacks though, which would be important.
> > 
> > Advice?  Are there good materials I can read about handling GTK+ (C
> > generated) callbacks with scripting languages?  Anyone have experience?
> 
> http://www.pygtk.org for the python/gtk+ part. You can also jump to
> #pygtk on irc.gimp.org.  Planner has some Python integration that
> enables interaction between C and Python codes.  I didn't clearly
> understood what you want to do, but those are starting points.

Thanks Xavier,

I've been playing with the perl option.   The how-to information  I've
been using is available here:

http://www.die.net/doc/linux/man/man1/perlembed.1.html

it's pretty cool stuff.  It will allow me to embed a perl interpreter
into my application and allow me to run arbitrary perl code at any time.
The embedded perl interpreter will maintain a persistent state too, so
I'll be able to create a few perl objects in one invocation, then go do
some C-Gtk stuff, then use those previously instantiated perl objects in
a second invocation.  (It may be possible to do thins like...  pass a
reference to an existing GtkWidget down into the perl stack and, using
the Gtk2::* perl stuff to operate on those widgets...  which could be
very cool and/or could be completely useless.  it would be interesting.)

I wrote to this list in the first place though because of the language
independent features of Gtk.  I'm not sure how "best" to use those
features in conjunction with this embedded perl though.  ("best" as in:
the way that will require the least amount of work in the long run and
that may make it possible to add new perl routines without recompiling
the C app.)

I think I don't understand well enough the real purpose marshalers to
make an informed decision.  So, I may just hack something together now,
and go back and do it correctly when I understand a little better.

- Ben




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]