File created 5 July 2004.
 Caml/Tk Examples
Caml/Tk Examples
This directories contains graphical user interface examples using
the Caml interface to Tcl/Tk.
Basic examples
- start.ml:
 A first program that justs creates a button labelled Hello.
- hello.ml:
 Hello
 Creates a button with an action attached to it.
- stop.ml:
 Creates a button a single button with a call back function
that quits the program.
- hello_quit.ml:
 Similar to- hello.ml, but with an additional quit button
 (and a first example of geometry packing specification).
- addition.ml:
 A simple program that adds 2 numbers typed in two input areas.
- rgb.ml:
 The specification of a color using three scales that give the respective
 amounts of red, green, and blue components of the color.
- convert_euro.ml:
 Converts a given amount from francs to euros, and converse.
- convert.ml:
 Converts a given amount from a given currency to another one. Source
 and target currencies are chosen using a menu.
More advanced examples
- camleyes.ml:
 A Caml/Tk (sort of) clone of Xeyes. Introduce the notion of canvas.
- taquin.ml:
 A simple game that uses images: cut the image into pieces then add an
 empty place to move over pieces. You must reconstruct a coherent
 image. Relatively advanced example.
- tetris.ml:
 An interactive game. An advanced example using timers, canvas and images.
- mytext.ml:
 An advanced example of widget definition: the basic text widget is
equipped with scroll-bars and kill/yank facilities ``à la Emacs''.
Practice
To build an interactive toplevel named camltktop, including tk
ocamlmktop -I +labltk -custom labltk.cma -o ocamltktop
then load the file loadall.ml, using
ocamltktop -I +labltk
Then type in:
#use "loadall.ml";;
Contact the author Pierre.Weis@inria.fr