Blame examples_labltk/hello.ml

Packit bd2e5d
(***********************************************************************)
Packit bd2e5d
(*                                                                     *)
Packit bd2e5d
(*                 MLTk, Tcl/Tk interface of OCaml                     *)
Packit bd2e5d
(*                                                                     *)
Packit bd2e5d
(*    Francois Rouaix, Francois Pessaux, Jun Furuse and Pierre Weis    *)
Packit bd2e5d
(*               projet Cristal, INRIA Rocquencourt                    *)
Packit bd2e5d
(*            Jacques Garrigue, Kyoto University RIMS                  *)
Packit bd2e5d
(*                                                                     *)
Packit bd2e5d
(*  Copyright 2002 Institut National de Recherche en Informatique et   *)
Packit bd2e5d
(*  en Automatique and Kyoto University.  All rights reserved.         *)
Packit bd2e5d
(*  This file is distributed under the terms of the GNU Library        *)
Packit bd2e5d
(*  General Public License, with the special exception on linking      *)
Packit bd2e5d
(*  described in file LICENSE found in the OCaml source tree.          *)
Packit bd2e5d
(*                                                                     *)
Packit bd2e5d
(***********************************************************************)
Packit bd2e5d
Packit bd2e5d
(* $Id$ *)
Packit bd2e5d
Packit bd2e5d
(* LablTk4 Demonstration by JPF *)
Packit bd2e5d
Packit bd2e5d
(* First, open this modules for convenience *)
Packit bd2e5d
open Tk
Packit bd2e5d
Packit bd2e5d
(* initialization of Tk --- the result is a toplevel widget *)
Packit bd2e5d
let top = openTk ()
Packit bd2e5d
Packit bd2e5d
(* create a button on top *)
Packit bd2e5d
(* Button.create : use of create function defined in button.ml *)
Packit bd2e5d
(* But you shouldn't open Button module for other widget class modules use *)
Packit bd2e5d
let b = Button.create ~text: "Hello, LablTk!" top
Packit bd2e5d
Packit bd2e5d
(* Lack of toplevel expressions in lsl, you must use dummy let exp. *)
Packit bd2e5d
let _ = pack [coe b]
Packit bd2e5d
Packit bd2e5d
(* Last, you must call mainLoop *)
Packit bd2e5d
(* You can write just let _ = mainLoop () *)
Packit bd2e5d
(* But Printexc.print will help you *)
Packit bd2e5d
let _ = Printexc.print mainLoop ()