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



On Tue, Sep 01, 2009 at 14:07:37 +0200, ecir hana wrote:
On Tue, Sep 1, 2009 at 1:14 PM, Jan Hudec<bulb ucw cz> wrote:

The OP does not seem to be. He says "like the example for Lua" and that shows
running lua code from vala.

Yes. And also calling Vala code from Lua. Or Python.

Just to check if I'm on the right track:
- just to run some python from Vala I can use Frederik's code from above
- and to call Vala from Python, I have to, according:
http://docs.python.org/extending/embedding.html#extending-embedded-python
add to Frederik's code the definition of "Py_InitModule()", which in
turn needs "PyMethodDef()" and "PyObject()" and if I don't have to
return anything, that's all because PyMethodDef() could return NULL.

Is this correct, so far?

Yes. Except if you need something bigger than a toy, I suggest you look at
the python-gobject bindings. Vala generates gobject-based api which complies
to all the glib/gobject/gtk conventions, so the tools for wrapping those to
python provided by python-gobject would be useful.

Besides, if you look at http://live.gnome.org/PyGObject, they are adding
gobject-introspection support. Not everything might work, but many things
probably will and you don't have to write a single dot for it.

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



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