Created
March 28, 2013 00:25
-
-
Save hkoba/5259450 to your computer and use it in GitHub Desktop.
How to use [tktable](http://tktable.sourceforge.net/tktable/doc/tkTable.html) from OCaml labltk.
(Not yet typesafe)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#directory "+labltk";; | |
#load "labltk.cma";; | |
let top = Tk.openTk () | |
let rec tcl_eval_str str = | |
tcl_eval_list (Protocol.splitlist str) | |
and tcl_eval_list lst = | |
Protocol.tkEval (list2tkArgs lst) | |
and list2tkArgs lst = | |
Array.of_list (List.map (fun i -> Protocol.TkToken i) lst) | |
;; | |
let _ = tcl_eval_str "package require Tktable" | |
let w = Widget.new_atom "table" ~parent:top | |
let _ = print_endline (Widget.name w) | |
let _ = tcl_eval_list ["table"; (Widget.name w); "-cache"; "yes"] | |
let _ = Tk.pack [Tk.coe w] | |
let _ = Printexc.print Tk.mainLoop () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment