Re: [Vala] Embed Python into Vala, extend Vala with Python



On Tue, Sep 01, 2009 at 10:19:34 +0200, ecir hana wrote:
How to use Vala with Python? How to achieve something like this:
http://live.gnome.org/Vala/LuaSample

You would need a .vapi for the python library. There is none in the vala
distribution, so search the web whether somebody already did anything in that
direction, otherwise you'd have to write it.

The API is bigger, so it would be more work than Lua, but for the start you
don't need everything -- just the functions to load code, execute it and
control the execution.

However, it might be better to go the other way around. Implement your code
in vala as library, bind it to python and call it from there. I believe there
is experimental implementation of gobject-introspection for python. As far as
it works, any vala code should be just callable from python including ability
to bind python callbacks to signals with no extra effort (just ask valac to
generate the .gir and compile it to typelib with g-ir-compiler). As far as it
does not (I didn't try it and it's supposed to be experimental), python-glib
has some reasonable tooling to do the binding.

Btw: is it possible to stop the execution of Python function?

You would have to look into the python library API.

-- 
                                                 Jan 'Bulb' Hudec <bulb ucw cz>



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