<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta name="generator" content="hevea 2.00"> <link rel="stylesheet" type="text/css" href="manual.css"> <title>The LablTk library: Tcl/Tk GUI interface</title> </head> <body> <a href="libdynlink.html"><img src="previous_motif.gif" alt="Previous"></a> <a href="index.html"><img src="contents_motif.gif" alt="Up"></a> <a href="libbigarray.html"><img src="next_motif.gif" alt="Next"></a> <hr> <h1 class="chapter" id="sec476">Chapter 28  The LablTk library: Tcl/Tk GUI interface</h1> <p>The <span class="c007">labltk</span> library provides access to the Tcl/Tk GUI from OCaml 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 <span class="c007">ocamlbrowser</span> to see the types of the various functions, that are the best documentation for the library itself.</p><p><br> Programs that use the <span class="c007">labltk</span> library must be linked as follows: </p><pre> ocamlc <span class="c013">other options</span> -I +labltk labltk.cma <span class="c013">other files</span> ocamlopt <span class="c013">other options</span> -I +labltk labltk.cmxa <span class="c013">other files</span> </pre><blockquote class="quote"><span class="c011">Unix:</span>   The <span class="c007">labltk</span> library is available for any system with Tcl/Tk installed, starting from Tcl 7.5/Tk 4.1 up to Tcl/Tk 8.4. Beware that some beta versions may have compatibility problems.<p>If the library was not compiled correctly, try to run again the <span class="c007">configure</span> script with the option <span class="c007">-tkdefs</span> <span class="c013">switches</span>, where <span class="c013">switches</span> is a list of C-style inclusion paths leading to the right <span class="c007">tcl.h</span> and <span class="c007">tk.h</span>, for instance <span class="c007">"-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4"</span>.</p><p>A script is installed, to make easier the use of the <span class="c007">labltk</span> library as toplevel. </p><dl class="description"><dt class="dt-description"> <span class="c010">labltk</span></dt><dd class="dd-description"> This is a toplevel including the <span class="c007">labltk</span> 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 <span class="c007">ocaml</span>. </dd></dl></blockquote><blockquote class="quote"><span class="c011">Windows:</span>   The <span class="c007">labltk</span> library has been precompiled for use with Tcl/Tk 8.4. You must first have it installed on your system. It can be downloaded from <br> <span class="c007">http://www.activestate.com/products/ActiveTcl/</span>. After installing it, you must put the dynamically loaded libraries <span class="c007">tcl84.dll</span> and <span class="c007">tk84.dll</span> (from the <span class="c007">bin</span> directory of the Tcl installation) in a directory included in you path.<p>No toplevel is available, but you can load the library from the standard toplevel with the following commands. </p><blockquote class="quote"> <pre># #directory "+labltk";; # #load "labltk.cma";; </pre></blockquote><p> You can also load it directly from the command line. </p><blockquote class="quote"> <pre>C:\ocaml\bin> ocaml -I +labltk labltk.cma </pre></blockquote></blockquote><p>The <span class="c007">labltk</span> library is composed of a large number of modules. </p><blockquote class="quote"> <pre>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 </pre></blockquote><p>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 <span class="c007">Tk</span>. Note that for most other modules information can be found in the Tcl <span class="c007">man</span> page of their name.</p><ul class="ftoc2"><li class="li-links"> <a href="libref/Tk.html">The <span class="c007">Tk</span> library: Basic functions and types for LablTk</a> </li></ul> <hr> <a href="libdynlink.html"><img src="previous_motif.gif" alt="Previous"></a> <a href="index.html"><img src="contents_motif.gif" alt="Up"></a> <a href="libbigarray.html"><img src="next_motif.gif" alt="Next"></a> </body> </html>