I am trying to move an application from Windows -> Linux and the graphics part seems to be the most difficult. I hope that ltk can help me along.
Under ubuntu 8.10 and SBCL 1.0.23 I have downloaded ltk-0.91.tgz and extracted it into its own directory.
SBCL happily compiled ltk.lisp and ltk.fasl loaded too.
When I tried to run (ltktest) SBCL became unhappy: Couldn't write to #<SB-SYS:FD-STREAM for "descriptor 6" {B98E79}>: Broken pipe.
Perhaps I have put ltk in the wrong place ? Perhaps there is something which I have failed to set up correctly.
I see from the troubleshooting file that some web connections/applications can cause difficulty. I am running firefox - from which I retrieve ltk!
Any and all advice/comments gratefully received
Cheers /Greg Bennett
When I tried to run (ltktest) SBCL became unhappy: Couldn't write to #<SB-SYS:FD-STREAM for "descriptor 6" {B98E79}>: Broken pipe.
As a wild guess, maybe sbcl is having trouble connecting to the Tk command shell (wish)? Try setting *debug-tk* true before running the example. That may produce some useful output that you could send to this list.
- Daniel
Hi Greg,
the problems with web applications refer to windows - on Linux with SBCL (a combination I am using myself) I had never such problems. To run tcl/tk, LTk tries to run "wish". Can you check whether wish is in your path and which version it is? Just type wish at the shell and see what happens. If it is not in the path, either add it to the path, or change the variable *wish-pathname* to contain the wish executable to run. (On some systems it is called wish8.4 or wish8.5 for example).
If that all does not help, please try to paste the whole error output into a mail.
Peter
Peter, thanks for the message; thanks also to Daniel Herring and Victor. It turns out that I did not have tcl and tk installed. I now have them and all is well in that at the shell (bash) wish -> a blank window and a % prompt
while inside SBCL (ltktest) and (ltk::ltk-eyes) do their thing. As does the first example from the documentation. So thanks all, once more. ;;;; My lisp experience is with Franz's Allegro and their common graphics. There I can open a window and keep the listener/repl alive. From the repl (setf w make-a-window-syntax) then allows me to do things like (draw-to w some-graphic) from that REPL. This facility is important to the application I'm interested in porting; I guess it means that I must learn how to program with threads/processes to obtain this behaviour.
Cheers /Greg Bennett *** Peter Herth wrote:
Hi Greg,
the problems with web applications refer to windows - on Linux with SBCL (a combination I am using myself) I had never such problems. To run tcl/tk, LTk tries to run "wish". Can you check whether wish is in your path and which version it is? Just type wish at the shell and see what happens. If it is not in the path, either add it to the path, or change the variable *wish-pathname* to contain the wish executable to run. (On some systems it is called wish8.4 or wish8.5 for example).
If that all does not help, please try to paste the whole error output into a mail.
Peter
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
Hi Greg,
On Sun, Dec 6, 2009 at 2:03 AM, Greg Bennett gwbennett@sentex.ca wrote:
Peter, thanks for the message; thanks also to Daniel Herring and Victor. It turns out that I did not have tcl and tk installed. I now have them and all is well in that at the shell (bash) wish -> a blank window and a % prompt
while inside SBCL (ltktest) and (ltk::ltk-eyes) do their thing. As does the first example from the documentation. So thanks all, once more.
Good that this was resolved so easily :)
;;;; My lisp experience is with Franz's Allegro and their common graphics. There I can open a window and keep the listener/repl alive. From the repl (setf w make-a-window-syntax) then allows me to do things like (draw-to w some-graphic) from that REPL. This facility is important to the application I'm interested in porting; I guess it means that I must learn how to program with threads/processes to obtain this behaviour.
First of all - you can interactively call start-wish to start a wish session and then use all LTk-functions from the repl (you will get events handles only if you call process-events or mainloop). However this is only for testing and interactive development.
If you want to have a lisp repl within a LTk program, I would not recommend threads. Amongst all other possible problems, the LTk functionality should be used only from one thread. But fortunately, this is not necessary if you want for example just integrate a lisp listener into a LTk program. The easiest solution would be, to use a textfield for the repl interaction and trigger the Lisp evaluation from the corresponding Tk events - no threads needed. ABLE implements a small Lisp IDE completely in LTk.
Peter
2009/12/6 Peter Herth herth@peter-herth.de:
On Sun, Dec 6, 2009 at 2:03 AM, Greg Bennett gwbennett@sentex.ca wrote:
My lisp experience is with Franz's Allegro and their common graphics. There I can open a window and keep the listener/repl alive. From the repl (setf w make-a-window-syntax) then allows me to do things like (draw-to w some-graphic) from that REPL. This facility is important to the application I'm interested in porting; I guess it means that I must learn how to program with threads/processes to obtain this behaviour.
First of all - you can interactively call start-wish to start a wish session and then use all LTk-functions from the repl (you will get events handles only if you call process-events or mainloop). However this is only for testing and interactive development.
If you want to have a lisp repl within a LTk program, I would not recommend threads. Amongst all other possible problems, the LTk functionality should be used only from one thread. But fortunately, this is not necessary if you want for example just integrate a lisp listener into a LTk program. The easiest solution would be, to use a textfield for the repl interaction and trigger the Lisp evaluation from the corresponding Tk events - no threads needed. ABLE implements a small Lisp IDE completely in LTk.
I just have a few things to add to what Peter said:
* Regarding threads, Ltk is most certainly not reentrantly thread-safe. It's in a situation like Apple's Cocoa is/was; you may have multiple threads, but only one may control the GUI. Changing this isn't especially a priority as in practice it's never been a problem.
* I agree that an Ltk-based REPL would be the right answer if it's to be part of an application. But there is another, SBCL-specific way to launch an Ltk program and keep the REPL responsive. You can tell Ltk to integrate itself into the SBCL main event loop by doing (with-ltk (:serve-event t) ...).
I added the serve-event backend precisely to be able to interact with the running gui without having to call (mainloop) manually :-)
-Thomas
Peter, again thanks for the information and advice, and belated thanks for creating ltk. I find the idea of using a textfield inside ltk for interactions with the repl appealing; now I just have to read some more to figure out what that means in practice :-) !
*** Without wishing to start/continue/renew any "my lisp/OS is better than yours" threads, and without cluttering up the list with code from my attempts, I remain puzzled that my experience with Allegro under Windows is so different.
I did succeed in using (start-wish) followed by some of your examples, which left me with a live repl .. until I wanted to get a response from eg. clicking on a button. Activating (mainloop) got the response, but the repl froze. C-c C-c in slime, plus choosing option 1 did get me an repl back. Short of killing my example window, this was the only way I could interrupt that mainloop.
What I still missed was the possibility, for example, of testing things by (a) using your "More complex example" with a live repl as above, and (b) from that repl writing something like (erase-line canvas-of-example (list ..)) to see it disappear.
*nix graphics seem to grab control of my lisp repl in a way I am not accustomed to, and for which I do not have a mental model (yet).
But, after dealing with some undergraduate examinations, it's on to trying to obtain repl interactions via textfields and Tk events!
Cheers /Greg
Peter Herth wrote:
Hi Greg,
On Sun, Dec 6, 2009 at 2:03 AM, Greg Bennett gwbennett@sentex.ca wrote:
Peter, thanks for the message; thanks also to Daniel Herring and Victor. It turns out that I did not have tcl and tk installed. I now have them and all is well in that at the shell (bash) wish -> a blank window and a % prompt
while inside SBCL (ltktest) and (ltk::ltk-eyes) do their thing. As does the first example from the documentation. So thanks all, once more.
Good that this was resolved so easily :)
;;;; My lisp experience is with Franz's Allegro and their common graphics. There I can open a window and keep the listener/repl alive. From the repl (setf w make-a-window-syntax) then allows me to do things like (draw-to w some-graphic) from that REPL. This facility is important to the application I'm interested in porting; I guess it means that I must learn how to program with threads/processes to obtain this behaviour.
First of all - you can interactively call start-wish to start a wish session and then use all LTk-functions from the repl (you will get events handles only if you call process-events or mainloop). However this is only for testing and interactive development.
If you want to have a lisp repl within a LTk program, I would not recommend threads. Amongst all other possible problems, the LTk functionality should be used only from one thread. But fortunately, this is not necessary if you want for example just integrate a lisp listener into a LTk program. The easiest solution would be, to use a textfield for the repl interaction and trigger the Lisp evaluation from the corresponding Tk events - no threads needed. ABLE implements a small Lisp IDE completely in LTk.
Peter
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
Greg Bennett wrote:
Peter, again thanks for the information and advice, and belated thanks for creating ltk. I find the idea of using a textfield inside ltk for interactions with the repl appealing; now I just have to read some more to figure out what that means in practice :-) !
In practice it means you'll be back in six months* to announce your new Lisp IDE and the beginning of a 5-year project to create a parallelizing, cross-platform CL compiler.
You have been warned.
kt
* Just kidding. It will be three years.
On Fri, 04 Dec 2009 04:20:46 +0200, Greg Bennett gwbennett@sentex.ca wrote:
I am trying to move an application from Windows -> Linux and the graphics part seems to be the most difficult. I hope that ltk can help me along.
Under ubuntu 8.10 and SBCL 1.0.23 I have downloaded ltk-0.91.tgz and extracted it into its own directory.
SBCL happily compiled ltk.lisp and ltk.fasl loaded too.
When I tried to run (ltktest) SBCL became unhappy: Couldn't write to #<SB-SYS:FD-STREAM for "descriptor 6" {B98E79}>: Broken pipe.
Perhaps I have put ltk in the wrong place ? Perhaps there is something which I have failed to set up correctly.
I see from the troubleshooting file that some web connections/applications can cause difficulty. I am running firefox - from which I retrieve ltk!
Any and all advice/comments gratefully received
Cheers /Greg Bennett
Hello Greg,
On the first glance I see that you don't tell a word about which version of Tcl/Tk you've got installed.
With best regards,
Victor