[英]Can I build a graphical interface from ocaml toplevel?
À few questions regarding the interactive toplevel and graphical UI programming: - 关于交互式顶层和图形UI编程的几个问题:
Is it possible to build a graphical interface dynamically from ocaml toplevel? 是否可以从ocaml toplevel动态构建图形界面?
It is possible to use the Graphics library too? 也可以使用图形库吗?
install lwt-glib and lablgtk, on debian based systems: 在基于debian的系统上安装lwt-glib和lablgtk:
apt-get install liblwt-glib-ocaml-dev liblablgtk2-ocaml-dev apt-get install liblwt-glib-ocaml-dev liblablgtk2-ocaml-dev
in the OCaml toplevel, load everything: 在OCaml顶级,加载一切:
#use "topfind";;
#require "lwt.simple-top";;
#require "lwt.glib";;
#require "lablgtk2";;
then initialise the GTK and the LWT integration: 然后初始化GTK和LWT集成:
GMain.init ();;
Lwt_glib.install ();;
And play: 玩:
let w = GWindow.window ();;
w#show ();;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.