1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Graphical user interface using Caml/Tk
Start
A first program that justs creates a button labelled Hello.
Hello
Creates a button with an action attached to it.
Hello_quit
Same as Hello, but additional quit button (and first example of
geometry packing specification).
Addition
A simple program that adds 2 numbers typed in two input areas.
Rgb
Specification of a color using three scales that give the respective
amounts of red, green, and blue components of the color.
Convert_euro
Converts a given amount from francs to euros, and converse.
Convert
Converts a given amount from a given currency to another one. Source
and target currencies are chosen using a menu.
Camleyes
A Caml/Tk (sort of) clone of Xeyes. Introduce the notion of canvas.
Taquin
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
An interactive game. An advanced example using timers, canvas and images.
To build an interactive toplevel named camltktop, including tk
ocamlmktop -I +labltk -custom labltk.cma -o ocamltktop
then load the file loadall.ml
ocamltktop -I +labltk
where + stands for the path to camltk on your local installation
(for instance /usr/local/lib/ocaml/labltk)
Then type in:
#use "loadall.ml";;
|