如何在 Windows 中获得 common-lisp GUI?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/450538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I get a common-lisp GUI in Windows?
提问by Andrew Larned
I'm using Emacs, with CLISP and Slime, and want to be able to draw pictures on the screen. I'm specifically thinking about drawing graphs, but anything that would let me draw basic shapes and manipulate them would be able to get me started.
我正在使用带有 CLISP 和 Slime 的 Emacs,并且希望能够在屏幕上绘制图片。我特别考虑绘制图形,但任何可以让我绘制基本形状并操纵它们的东西都可以让我开始。
采纳答案by Andrew Larned
I think I've found my own answer. Clojureseems to have everything I was looking for, just because I can now use all of the Java GUI items natively in LISP. It is a different dialect of LISP than the Common-Lisp I was using, but seems to have a lot of community support, and integrates with my Windows installation of Emacs either through SLIME or through the Inferior-Lisp interpreter. So far I've been very impressed.
我想我已经找到了自己的答案。Clojure似乎拥有我想要的一切,因为我现在可以在 LISP 中本地使用所有 Java GUI 项目。它是与我使用的 Common-Lisp 不同的 LISP 方言,但似乎有很多社区支持,并且通过 SLIME 或通过 Inferior-Lisp 解释器与我在 Windows 上安装的 Emacs 集成。到目前为止,我印象非常深刻。
Oh, a code sample:
哦,一个代码示例:
(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
Any guesses what this does? :)
猜猜这是做什么的?:)
Bill Clementson's blog has quite a bit on Clojure, including a lot of helpful posts on installing it. See here: his posts on Clojure
Bill Clementson 的博客有很多关于 Clojure 的内容,包括很多关于安装它的有用帖子。见这里:他在 Clojure 上的帖子
回答by Friedrich
Doug is right; CAPI will work fine. Other things you can try:
道格是对的;CAPI 将正常工作。你可以尝试的其他事情:
cltk: http://www.cliki.net/Lisp-Tk
cltk:http://www.cliki.net/Lisp-Tk
I know that Allegro has something for Windows programming also, but I've never tried it.
我知道 Allegro 也有一些用于 Windows 编程的东西,但我从未尝试过。
What may also work is cells-gtk: http://common-lisp.net/project/cells-gtk/
也可以使用 cell-gtk:http: //common-lisp.net/project/cells-gtk/
Again, I can only tell you that it exists but not how bad it is or if it even really works...
再说一次,我只能告诉你它存在,但不能告诉你它有多糟糕,或者它是否真的有效......
I can not comment also on the quality of http://www.cliki.net/GTK%20binding
我也不能评论http://www.cliki.net/GTK%20binding的质量
But that's mostly what is available.
但这主要是可用的。
Corman Lisp probably has something to offer for Windows programming also.
Corman Lisp 可能也为 Windows 编程提供了一些东西。
Anyway, the choices on Windows are relatively slim. The you can probably have the most confidence in CAPI, which is used for the LispWorks IDE on Windows, Linux, MacOS X and on quite few big unices also...
无论如何,Windows 上的选择相对较少。您可能对 CAPI 最有信心,它用于 Windows、Linux、MacOS X 上的 LispWorks IDE 以及一些大型 unice 上的 LispWorks IDE。
Regards
问候
回答by Leslie P. Polzer
For rolling your own (like you said, basic shapes) try Lispbuilder-SDLor one of the cl-cairo FFIs (it's just my guess that the latter work with MS Windows, though).
要滚动您自己的(如您所说的基本形状),请尝试使用Lispbuilder-SDL或 cl-cairo FFI 之一(不过我猜测后者适用于 MS Windows)。
回答by asm
I know this is an old post, but so the information is here for others like me who find this thread looking for the same thing.
我知道这是一个旧帖子,但这里的信息是为像我这样的人提供的,他们发现这个线程正在寻找相同的东西。
This library for tk bindings in common lisp seems to work fairly well. http://www.peter-herth.de/ltk/
这个用于通用 lisp 中 tk 绑定的库似乎运行良好。 http://www.peter-herth.de/ltk/
回答by Doug Currie
You could switch from CLISP to the free LispWorks Personal Editionand use the CAPIGraphics Ports drawing API.
您可以从 CLISP 切换到免费的 LispWorks 个人版并使用CAPI图形端口绘图 API。
Or you could use Lisp's Foreign Function Interfaceand use one of the graphics toolkits available for your OS.
或者您可以使用 Lisp 的外部函数接口并使用适用于您的操作系统的图形工具包之一。
回答by fred-o
Clojure is an excellent Lisp, and Swing is a solid (if not particularly visually exciting) windowing toolkit. If you want do do more advanced graphics and/or dabble with game programming you might want to check out Slick, which is a general purpose graphics/game library that sits on top of Swing and gives you access to OpenGL and lots of other stuff.
Clojure 是一个出色的 Lisp,而 Swing 是一个可靠的(如果不是特别令人兴奋的视觉效果)窗口工具包。如果您想做更高级的图形和/或涉足游戏编程,您可能需要查看Slick,它是一个位于 Swing 之上的通用图形/游戏库,可让您访问 OpenGL 和许多其他东西。
I've found the Clojure/Slick combination an excellent way to do exploratory graphics programming, as you can interact with the graphics window directly from the REPL.
我发现 Clojure/Slick 组合是进行探索性图形编程的绝佳方式,因为您可以直接从 REPL 与图形窗口进行交互。
回答by dmitry_vk
There's cl-cairo2- a binding to Cairo vector drawing library. It can be used to draw various pictures on various surfaces. There's a cl-2dlibrary that uses cl-cairo2 to draw charts.
有cl-cairo2- 与开罗矢量绘图库的绑定。它可用于在各种表面上绘制各种图片。有一个使用 cl-cairo2 绘制图表的cl-2d库。
And there's cl-gtk2- a binding to Gtk+ library. You can create widgets that are drawn with cl-cairo2 (or cl-2d) that draw what you want.
还有cl-gtk2- 与 Gtk+ 库的绑定。您可以创建使用 cl-cairo2(或 cl-2d)绘制的小部件来绘制您想要的内容。
回答by CSP
CLISP users might find The following useful for their graphics applications:
CLISP 用户可能会发现以下内容对他们的图形应用程序很有用:
cl-vectors is a pure Common Lisp library to create, transform and render anti-aliased vectorial paths. It can be installed using ASDF-Install. http://projects.tuxee.net/cl-vectors/
Vecto is a simplified interface to the powerful CL-VECTORS vector rasterization library....the results can be saved to a PNG ... Since Vecto and all supporting libraries are written completely in Common Lisp, without depending on external non-Lisp libraries, it should work in any Common Lisp environment. Vecto is available under a BSD-like license. The current version is 1.4.3, released on August 26, 2009. http://www.xach.com/lisp/vecto/
cl-vectors 是一个纯粹的 Common Lisp 库,用于创建、转换和渲染抗锯齿矢量路径。它可以使用 ASDF-Install 进行安装。 http://projects.tuxee.net/cl-vectors/
Vecto 是强大的 CL-VECTORS 矢量光栅化库的简化接口....结果可以保存到 PNG ...因为 Vecto 和所有支持库完全用 Common Lisp 编写,不依赖外部非 Lisp 库,它应该可以在任何 Common Lisp 环境中工作。Vecto 在类似 BSD 的许可下可用。当前版本为 1.4.3,于 2009 年 8 月 26 日发布。 http://www.xach.com/lisp/vecto/