lua-users home
lua-l archive

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


Finally!  I have been looking for a lua binding to GTK that takes full advantage of the GObject system.  I was looking into it awhile ago, but have not had any time to try working on it.  I would be really interested in seeing how you did it.

Mike

On 1/25/07, Alex Queiroz <asandroq@gmail.com> wrote:
Hallo,

     In search for a portable GUI for Lua, I've decided to try GTK.
It's not BSD licensed nor draws native widgets, but the LGPL is
flexible enough and I may need to target embedded devices where there
is not a 'native' widget set.
     There is a project lua-gtk in luaforge (which I can't access
right now), but AFAIK it doesn't take advantage of the marvelous
GObject system:

* By binding GValue, I automagically got the power to write callbacks
in pure Lua and the GClosure marshaling interface can now connect any
signal emitted by a GObject to them.

     win:connect('destroy', function() gtk.main_quit() return true end)

* By binding the GObject property system, I can change labels, images,
texts etc. of widgets without writing bindings for every possible
function.

     button.label = 'OK'
     image.file = 'clock.png'

* By binding libglade, I can do all the hard work of building the GUI
in glade and autoconnect all the signals to their respective handlers.

     local gxml = gtk.glade.from_xml('app.glade')
     local win = gxml:get_widget('main_window')
     gxml:autoconnect()
     win:show_all()

     The software is not really usable right now for building a
complete application, but I am sending an email already so anyone
thinking about doing the same can join instead of duplicating efforts.
I guess it's gonna become usable very soon, because I've never seen a
better thought C API than GObject. Any feedback is appreciated.

Cheers,

--
-alex
http://www.ventonegro.org/