I will investigate cl-gtk2.  Major roadblock, though -  I am having trouble with sbcl built with threads on max os (darwin) - either through macports or by downloading and building source..when running under slime, it wants to terminated unexpectedly when I load any program from slime.  works OK in repl.

On Thu, Jul 1, 2010 at 11:06 AM, Kalyanov Dmitry <kalyanov.dmitry@gmail.com> wrote:
On Thursday 01 July 2010 10:05:57, Kevin Smith wrote:
> I just posted this one in comp.lang.lisp, but after thinking about it a
> bit, perhaps it is lisp implementation specific to sbcl, so I post it here
> also...
> I'm a newcomer to lisp and I have a few questions I am running into
> during the course of my prototyping..
> It would be extremely useful to be able to run a function from the
> repl that executes some even-driven user-interface in the background,
> while control is returned to the repl so that I can continue to issues
> more lisp function calls interactively (that affect the running user-
> interface)..

You would just have to run event in background. Some toolkits already do this.
E.g., cl-gtk2 on lisp implementations that have threads will start Gtk+ main
loop in background thread, leaving REPL ready for interaction.

This is an example of interactive session with cl-gtk2 on SBCL:

CL-USER> (defvar *w*)
CL-USER> (gtk:within-main-loop ;; execute code in the context of event loop
          (setf *w* (make-instance 'gtk:gtk-window :title "Window"))
          (gtk:container-add *w* (make-instance 'gtk:label :label "Hello!"))
          (gtk:widget-show *w*))
; No value
CL-USER> ;; A window has appeared
; No value
CL-USER> (gtk:within-main-loop
          (setf (gtk:label-angle (gtk:container-child *w*)) 45d0))
; No value
CL-USER> ;; Label has rotated
; No value
CL-USER> (gtk:within-main-loop
          (gtk:container-remove *w* (gtk:container-child *w*)))
; No value
CL-USER> ;; Window is now empty
; No value

For education purposes, interactive GUI programming is very useful. I myself
studied opengl by incrementally improving code that was continuously drawing
with cl-opengl.

Кальянов Дмитрий

This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
Sbcl-help mailing list