使用 labltk 并排按钮
Buttons side-by-side using labltk
我在 Ocaml 中使用 labltk
。我想并排创建三个按钮。
假设如下代码:
#load "labltk.cma";;
let top = openTk() in
...
let button1 = Button.create
~text:"Button 1"
~command:(fun () -> Tk.closeTk (); exit 0)
top in
let button2 = Button.create
~text:"Button 2"
~command:(fun () -> Tk.closeTk (); exit 0)
top in
let button3 = Button.create
~text:"Button 3"
~command:(fun () -> Tk.closeTk (); exit 0)
top in
...
现在,按钮是一个在其他按钮之上。是否有使按钮并排
的解决方法
对于简单的布局你可以pack
他们:
pack ~side:`Left [button1;button2;button3] ;;
我在 Ocaml 中使用 labltk
。我想并排创建三个按钮。
假设如下代码:
#load "labltk.cma";;
let top = openTk() in
...
let button1 = Button.create
~text:"Button 1"
~command:(fun () -> Tk.closeTk (); exit 0)
top in
let button2 = Button.create
~text:"Button 2"
~command:(fun () -> Tk.closeTk (); exit 0)
top in
let button3 = Button.create
~text:"Button 3"
~command:(fun () -> Tk.closeTk (); exit 0)
top in
...
现在,按钮是一个在其他按钮之上。是否有使按钮并排
的解决方法对于简单的布局你可以pack
他们:
pack ~side:`Left [button1;button2;button3] ;;