I've updated labltk to use some new widgets and commands that are available
in Tk 8.4.
get the ocaml 3.10 beta release
extract the ocaml beta archive
replace otherlibs/labltk with the one from the following link
configure, make world, make install
This is a BETA release, meaning that I believe I've implemented all the new
features, but I haven't tested them much.
Here are my additions to the changelog:
2007-05-11 (*BETA release from shaw...@msu.edu*)
*labltk now requires Tk 8.4
*added spinbox widget
*added TkConsole module
*added labelframe widget
*added panedwindow widget
*added functions tk_textCopy, tk_textCut, tk_text_Paste to the text widget
*Removed tkanim (depended on Camltk)
*Removed Frx (Depended on Camltk)
*Removed examples_camltk (Depended on Camltk)
Please note that this is an unofficial release. I'm not affiliated with the
ocaml development team.
Caml-list mailing list. Subscription management:
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
In my mind, a few other things are missing in LablTk.
* Ease of installation.
At the moment, beginners who wish to use LablTk under Windows (or who
are pressed to do this by, say, their teacher) must first find and
install the correct version by inferring the location of the installer
from an erroneous link hidden in the fine print of the documentation of
As Tk is so important, i'm not sure why Tk is not bundled with OCaml's
Windows version. I suggest either bundling it or at least providing an
(up-to-date) link from OCaml's official download page .
At the moment, LablTk has virtually no documentation. The page in the
manual is barely an overview and suggests reading the documentation of
Tcl/Tl. Which is all fine and good, except that it doesn't help with
types, I can't for the life of me remember how I found out that type
~~ color ~~ is actually a polymorphic variant ~~ `Color of string ~~
and beginners who learn OCaml as their first or second programming
language will never manage that much.
I suggest including a LablTk tutorial, perhaps inspired of  and
actually ocamldocumenting the .mli .
* Other libraries
Ok, I might be asking a lot, but I personally consider that Graphics is
half-useless without CamlImages. I also consider that LablGl is a good
way to demonstrate the power of OCaml to students and perhaps to bring
them to something like game programming in OCaml. It requires CamlImages
for textures. The list could continue with LablGtk and plenty of others
but these two would be my personal priority.
Consequently, in my mind, both should be easy to install at the same
time as OCaml, which is not the case at the moment. Again, under Linux,
that's not much of a problem. Under Windows (and perhaps Mac OS X), it
is very much so.
I don't suggest providing a package manager under Windows and I do know
about GODI but I also know that students will never be bothered to
install GODI. What I do suggest is just either adding inside OCaml's
Windows installer the option to add "extension libraries", with a short
description of what each extension does, or providing links to binary
installers from OCaml's download page.
What do you think ?
or for the beta labltk...
Yup that link should be updated. I don't think it should be bundled with
ocaml, however. The end-user might already have it installed, or might not
need it. But this is a decision for the ocaml devs.
You're right, it's not very good. I used the ocamlbrowser extensively to
learn how to use labltk. It took me a lot of experimenting, and I'm still
terrible at getting widgets laid out the way I want.
I'm not sure how to do the documentation in an automated way without
changing the grammar for widgets.src to allow ocamldoc comments. That's
beyond my abilities, but I suppose it's a worthy project for someone. On the
other hand, widgets.src is already very cluttered.
* Other libraries
I don't know anything about these, but again these are questions for the
Anyway, my focus right now is getting this beta version of labltk working
correctly... there's a lot of functions to test.
Now here's an idea...
Instead of documenting labltk, which is difficult for the beginner ocaml
programmer anyway, make a wrapper to make it more ocaml-y. I'm not sure if
this would be easy or possible, but coercing labltk into one style of
programming (preferably functional) could go a long way towards making it
easier to learn for the beginner. Also the wrapper would potentially be
easier to document. As I recall, the most difficult aspects of labltk are
those that are imperative, eg:
event functions are unit -> unit, (maybe this can't be avoided)
pack is difficult to deal with,
the need to use optionmenu and Textvariable.handle together is not obvious
Another huge but useful project would be a type-safe parser for the outputs
given by the Widget.configure_get functions.
Now back to testing.
Of course. The congratulations were for you. The wish list was for OCaml
> Instead of documenting labltk, which is difficult for the beginner ocaml
> programmer anyway, make a wrapper to make it more ocaml-y. I'm not sure if
> this would be easy or possible, but coercing labltk into one style of
> programming (preferably functional) could go a long way towards making it
> easier to learn for the beginner.
I'm currently thinking about the best way to write the equivalent of
JavaFX for OCaml : both the user-interface and the "new features" (e.g.
list comprehension, SQL-ish selections from data structures, etc.). The
user-interface part doesn't look too difficult. I'll start to work on
it... well, if I ever get time.
PG'OCaml does the SQL part: http://merjis.com/developers/pgocaml
Actually, it doesn't.
What I'm talking about is applying SELECT to a OCaml (or, in that case,
Java) data structure, not to a SQL database. I'm not completely clear
about the semantics of the primitive, but it does look interesting.