My main problem with OCAML API's

Please forgive me if i nag.
Here is an API to bind gtk3 to ocaml.
https://garrigue.github.io/lablgtk/lablgtk3/lablgtk3/index.html
Just I have totally no idea how to use it.
Meaning i will go for another language for this kind of problem.

This is the same thing for python,
https://python-gtk-3-tutorial.readthedocs.io/en/latest/install.html

3 Likes

I have to agree, the lablgtk documentation makes it one of the hardest packages in the OCaml ecosystem to pick up (aside maybe from elpi :cry: ).

It would be nice to have an actual example based guide to using Lablgtk, but lacking that, I was able to work out how to use it by referring to the examples on the source repository: lablgtk/examples at lablgtk3 · garrigue/lablgtk · GitHub

This is for LablGtk2, but a lot is usable with v3 as well. May help.

2 Likes

This is for racket (scheme), look at the good documentation.
1 Windowing..Creating.Windows

I am not going to claim that the ocaml documentation is perfect or even above average - although the documentation for the standard library is in my view pretty good - but I don’t think your last one is an entirely fair point.

Racket has its own GUI library which to be usable has to be documented, whereas lablgtk3 is a thin wrapper over the GTK library. GTK is not a library I especially enjoy using, but If you need to know how to write a GTK program the best first resource is the documentation for GTK itself. It is easy enough to work out how that maps onto lablgtk.

For simple cases I have used js_of_ocaml with the gjs/gobject-introspection bindings for GTK3/4 which are also documented, so there are many options. (The python wrapper to which you have referred also uses gobject-introspection.)

1 Like

[I want to stay away of javascript as it is ugly]
I like the ocaml type system and the gtk3 framework.
All lablgtk examples compiled without problem, including interesting tree-widgets.
Looking at the code of the examples it is somewhat self-documenting.
The code is terse and short which is a good thing.

2 Likes