||The LablTk library: Tcl/Tk GUI interface
The labltk library provides access to the Tcl/Tk GUI from Objective
Caml programs. This interface is generated in an automated way, and
you should refer to Tcl/Tk books and man pages for detailed
information on the behavior of the numerous functions. We also suggest
to use ocamlbrowser to see the types of the various functions, that
are the best documentation for the library itself.
Programs that use the labltk library must be linked as follows:
ocamlc other options -I +labltk labltk.cma other files
ocamlopt other options -I +labltk labltk.cmxa other files
The labltk library is available for any system with Tcl/Tk installed,
starting from Tcl 7.5/Tk 4.1 up to Tcl/Tk 8.3. Beware that some beta
versions may have compatibility problems.
If the library was not compiled correctly, try to run again the
configure script with the option -tkdefs switches,
where switches is a list of C-style inclusion paths leading to
the right tcl.h and tk.h, for instance
A script is installed, to make easier the use of the labltk
library as toplevel.
This is a toplevel including the labltk library, and the path is
already set as to allow the use of the various modules. It also
includes code for the Unix and Str libraries. You can use it
in place of ocaml.
The labltk library has been precompiled for use with Tcl/Tk 8.3.
You must first have it installed on your system.
It can be downloaded from
The labltk library is composed of a large number of modules.
After installing it, you must put the dynamically loaded libraries
tcl83.dll and tk83.dll (from the bin directory of the Tcl
installation) in a directory included in you path.
No toplevel is available, but you can load the library from the
standard toplevel with the following commands.
You can also load it directly from the command line.
# #directory "+labltk";;
# #load "labltk.cma";;
C:\ocaml\bin> ocaml -I +labltk labltk.cma
Giving a detailed account of each of these module would be impractical
here. We will just present some of the basic functions in the module
Tk. Note that for most other modules information can be found in the
Tcl man page of their name.
Bell Imagebitmap Place
Button Imagephoto Radiobutton
Canvas Label Scale
Checkbutton Listbox Scrollbar
Clipboard Menu Selection
Dialog Menubutton Text
Entry Message Tk
Focus Option Tkwait
Frame Optionmenu Toplevel
Grab Pack Winfo
Grid Palette Wm
The Tk library: Basic functions and types for LablTk