-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathhello.ml
32 lines (27 loc) · 917 Bytes
/
hello.ml
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
(*
* hello.ml
* --------
* Copyright : (c) 2011, Jeremie Dimino <[email protected]>
* Licence : BSD3
*
* This file is a part of Lambda-Term.
*)
open Lwt
let main () =
(* Create a thread waiting for escape to be pressed. *)
let waiter, wakener = wait () in
(* Create the UI. *)
let vbox = new LTerm_widget.vbox in
vbox#add (new LTerm_widget.label "Hello, world!");
vbox#add (new LTerm_widget.label "你好,世界!");
vbox#add (new LTerm_widget.label "ハロー・ワールド");
vbox#add (new LTerm_widget.label "안녕, 세계!");
vbox#add (new LTerm_widget.label "Press escape to exit.");
vbox#on_event (function
| LTerm_event.Key { LTerm_key.code = LTerm_key.Escape; _ } -> wakeup wakener (); true
| _ -> false);
(* Run. *)
Lazy.force LTerm.stdout
>>= fun term ->
LTerm_widget.run term vbox waiter
let () = Lwt_main.run (main ())