Thursday, June 17, 2004

Lisp + Tk = LTk

Tk is quite a popular cross platform GUI library and Tcl and works identically across most platforms. Languages like Perl and Python use it as their standard GUI library with libraries like PerlTk and Python Tkinter. Over time many Lisp bindings have been written by passing Tcl commands over a stream to wish (The Tk interpreter). That however, required knowledge of Tcl.

Now there is LTk (currently in version 0.8) written by Peter Herth and is written entirely in Common Lisp with Lispy bindings to most Tk widgets. It lets you write an entire GUI application in Lisp.

The Lispy syntax is what makes LTk unique. Installing LTk is extremely simple as most of the code is in one file called ltk.lisp. The with-ltk macro sets up communication with Tk via a stream. LTk also comes with remote-ltk that lets you communicate from Lisp to Tk via a socket.

Installing LTk is as simple as firing the following commands from your Lisp REPL, provided you have Tcl/Tk (wish) installed.


(compile-file "ltk")
(load "ltk")
(use-package 'ltk)
(test)


If the test function runs without a problem, you should be all set. It also comes with an ASDF package if you prefer that. Please send feedback and patches to Peter so that this already nice package can be improved upon. Thanks again Peter.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home