在Clojure中做GUI的最好方法是什么? [英] What is the best way to do GUIs in Clojure?
本文介绍了在Clojure中做GUI的最好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Clojure 中使用GUI的最佳方法是什么?
What is the best way to do GUIs in Clojure?
有一些功能的示例 Swing 或 SWT 包装器?
或者与 JavaFX 声明式GUI描述集成,可以轻松地包装到 s-expressions 使用一些宏语言?
Is there an example of some functional Swing or SWT wrapper? Or some integration with JavaFX declarative GUI description which could be easily wrapped to s-expressions using some macrology?
任何教程?
推荐答案
我会谦虚地建议 Seesaw 。
这里有一个基于REPL的教程,假设没有Java或Swing知识
Here's a REPL-based tutorial that assumes no Java or Swing knowledge.
Seesaw很像@tomjen建议的。这里是Hello,World:
Seesaw's a lot like what @tomjen suggests. Here's "Hello, World":
(use 'seesaw.core)
(-> (frame :title "Hello"
:content "Hello, Seesaw"
:on-close :exit)
pack!
show!)
这里是@Abhijith和@ dsm的例子,翻译得很好:
and here's @Abhijith and @dsm's example, translated pretty literally:
(ns seesaw-test.core
(:use seesaw.core))
(defn handler
[event]
(alert event
(str "<html>Hello from <b>Clojure</b>. Button "
(.getActionCommand event) " clicked.")))
(-> (frame :title "Hello Swing" :on-close :exit
:content (button :text "Click Me" :listen [:action handler]))
pack!
show!)
这篇关于在Clojure中做GUI的最好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文