Hi,
maybe I'm missing something obvious, but LTK doesn't seem to work with double-floats for me. For instance:
(with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100))))
vs.
(with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100d0))))
In the first case, a window pops up with the line drawn as desired. But in the second case, an /empty/ window pops up. Further, when trying to to close the window, the window exits on one hand, but the Slime REPL doesn't get back. (I have to interrupt via `C-c C-c', and then type `q' to get out of SLDB.)
Huh? :-),
-T.
"Tobias C. Rittweiler" tcr@freebits.de writes:
Hi,
maybe I'm missing something obvious, but LTK doesn't seem to work with double-floats for me. For instance:
Excuse me, in my astonishment I forgot to tell that I'm running ltk-0.90, and experienced the phenemenon both on SBCL 1.0.5 and 1.0.7 as well as on clisp 2.41.
-T.
Hi Tobias.
I tried your code. They _both_ give exactly the same window with a line drawn from top left corner towards the center.
I'm running SBCL 1.0.7 and ActiveTCL 8.4.14. Windows XP
On 8/11/07, Tobias C. Rittweiler tcr@freebits.de wrote:
"Tobias C. Rittweiler" tcr@freebits.de writes:
Hi,
maybe I'm missing something obvious, but LTK doesn't seem to work with double-floats for me. For instance:
Excuse me, in my astonishment I forgot to tell that I'm running ltk-0.90, and experienced the phenemenon both on SBCL 1.0.5 and 1.0.7 as well as on clisp 2.41.
-T.
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
Denatus denatus@gmail.com writes:
Hi Tobias.
I tried your code. They _both_ give exactly the same window with a line drawn from top left corner towards the center.
Thank you for trying it out!
I'm running SBCL 1.0.7 and ActiveTCL 8.4.14. Windows XP
As said I also tried SBCL 1.0.7. I'm using the Ubuntu Edgy packages of TCL/TK which also seems to be ActiveState TCL 8.4.14. Furthermore, I encounter the described problem just when I simply paste the snippet into the SLIME REPL (so not exclusively there.)
As said in my first mail, in the problem case and after exiting the TK window, the REPL expression does not return on its own. I've got to interrupt it manually. The backtrace resulting from the interrupt can you see following my mail.
-T.
Interrupt from Emacs [Condition of type SIMPLE-ERROR]
Restarts: 0: [CONTINUE] Continue from interrupt. 1: [ABORT] Return to SLIME's top level. 2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {B1F8821}>)
Backtrace: 0: ((LAMBDA (SWANK-BACKEND::DEBUGGER-LOOP-FN)) #<FUNCTION (LAMBDA #) {B8C5B75}>) 1: (SWANK::DEBUG-IN-EMACS #<SIMPLE-ERROR {A700081}>) 2: (INVOKE-DEBUGGER #<SIMPLE-ERROR {A700081}>) 3: (INVOKE-DEBUGGER #<SIMPLE-ERROR {A700081}>) 4: ((LAMBDA ())) 5: ((LAMBDA ())) 6: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA #) {AB3928D}>) 7: (SWANK:SIMPLE-BREAK) 8: ((LAMBDA ())) 9: (SB-SYS:INVOKE-INTERRUPTION #<FUNCTION (LAMBDA #) {9041DED}>) 10: ("foreign function: #x806514C") 11: ("foreign function: #x80653A0") 12: ((FLET #:CLEANUP-FUN-75)) 13: (SB-KERNEL:SUB-GC) 14: ("foreign function: #x806514C") 15: ("foreign function: #x8051ED1") 16: ("foreign function: #x80529D8") 17: ("foreign function: #x8056C23") 18: ("foreign function: #x8056D5E") 19: ("no debug information for frame") 20: (READ-DATA) 21: ((LAMBDA ())) 22: ((LABELS USE-DEBUGGER) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA #) {B040B7D}>) 23: (CALL-WITH-LTK #<FUNCTION (LAMBDA #) {B0336ED}>) 24: (SB-INT:SIMPLE-EVAL-IN-LEXENV (WITH-LTK NIL (LET (#) (PACK C) (CREATE-LINE C '#))) #<NULL-LEXENV>) 25: (SWANK::EVAL-REGION "(with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100d0)))) " T) 26: ((LAMBDA ())) 27: ((LAMBDA (SWANK-BACKEND::FN)) #<CLOSURE (LAMBDA #) {B019FE5}>) 28: (SWANK::CALL-WITH-BUFFER-SYNTAX #<CLOSURE (LAMBDA #) {B019FE5}>) 29: (SWANK:LISTENER-EVAL "(with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100d0)))) ") 30: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100d0)))) ") #<NULL-LEXENV>) 31: ((LAMBDA ())) 32: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA #) {B019BD5}>) 33: ((LAMBDA ())) 34: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA #) {AB32BE5}>) 35: (SWANK::CALL-WITH-REDIRECTED-IO #<SWANK::CONNECTION {B001A59}> #<CLOSURE (LAMBDA #) {B019B25}>) 36: (SWANK::CALL-WITH-CONNECTION #<SWANK::CONNECTION {B001A59}> #<FUNCTION (LAMBDA #) {AB32BE5}>) 37: (SWANK::HANDLE-REQUEST #<SWANK::CONNECTION {B001A59}>) 38: (SWANK::REPL-LOOP #<SWANK::CONNECTION {B001A59}>) 39: (SWANK::REPL-LOOP #<SWANK::CONNECTION {B001A59}>) 40: (SWANK::CALL-WITH-BINDINGS NIL #<CLOSURE (LAMBDA #) {B2070A5}>) 41: ((LAMBDA ())) 42: ("foreign function: #x806514C") 43: ("foreign function: #x8051ED1") 44: ("foreign function: #x805D11D") 45: ("foreign function: #xB7FBF31B")
On 8/11/07, Tobias C. Rittweiler tcr@freebits.de wrote:
Hi,
maybe I'm missing something obvious, but LTK doesn't seem to work with double-floats for me. For instance:
(with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100d0))))
You're not missing anything; at the moment Ltk is sending the PRINC representation of your numbers to Tk, which means Tk gets something like 100.0d0, which it doesn't understand. This should be fixed in the Ltk release after next.
In the meantime, there are two work-arounds: either use single floats or set *read-default-float-format* to double-float. I don't see the point in using double-floats to represent on-screen values, but maybe they're the results of calculations where double-floats are warranted, in which case the second alternative might be easier than coercing to single-floats.
In the first case, a window pops up with the line drawn as desired. But in the second case, an /empty/ window pops up. Further, when trying to to close the window, the window exits on one hand, but the Slime REPL doesn't get back. (I have to interrupt via `C-c C-c', and then type `q' to get out of SLDB.)
Huh? :-),
-T.
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
"Thomas F. Burdick" tfb@ocf.berkeley.edu writes:
On 8/11/07, Tobias C. Rittweiler tcr@freebits.de wrote:
Hi,
maybe I'm missing something obvious, but LTK doesn't seem to work with double-floats for me. For instance:
(with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100d0))))
You're not missing anything; at the moment Ltk is sending the PRINC representation of your numbers to Tk, which means Tk gets something like 100.0d0, which it doesn't understand. This should be fixed in the Ltk release after next.
Yes, I've just discovered exactly that. May I ask how you intend to fix it? Not setting *print-pretty* to NIL in LTK:FORMAT-WISH, and then doing something like `(set-pprint-dispatch '(double-float) (formatter "~F"))'?
You probably also run the snippet with LTK:*DEBUG-TK* set to T (the output is attached below in any case) --- there seems to be another kind of problem that prevents LTK to handle the case gracefully, because as you see below, the process gets stuck in some kind of finalizer loop right when I exit the window.
In the meantime, there are two work-arounds: either use single floats or set *read-default-float-format* to double-float. I don't see the point in using double-floats to represent on-screen values, but maybe they're the results of calculations where double-floats are warranted, in which case the second alternative might be easier than coercing to single-floats.
They're results of calculations, indeed. Calculations that involve CL:PI to be precise. (Note that CL:PI just happens to be of type DOUBLE-FLOAT on SBCL, i.e. the same issue arises for numbers of type LONG-FLOAT.)
Thanks for your response, Thomas!
-T.
LTK> (let ((*debug-tk* t)) (with-ltk () (let ((c (make-canvas nil))) (pack c) (create-line c '(0 0 100 100d0))))) package require Tk proc escape {s} {regsub -all {\} $s {\\} s1;regsub -all {"} $s1 {"} s2;return $s2} proc senddata {s} {puts "(:data [escape $s])";flush stdout} proc senddatastring {s} {puts "(:data "[escape $s]")";flush stdout} proc senddatastrings {strings} { puts "(:data (" foreach s $strings { puts ""[escape $s]"" } puts "))";flush stdout}
proc sendevent {s x y keycode char width height root_x root_y mouse_button} {puts "(:event "$s" $x $y $keycode $char $width $height $root_x $root_y $mouse_button)"} proc callback {s} {puts "(:callback "$s")";flush stdout} proc callbackval {s val} {puts "(:callback "$s" $val)"} proc callbackstring {s val} {puts "(:callback "$s" "[escape $val]")"} canvas .w2 pack .w2 -side top -fill none senddata [.w2 create line 0 0 100 100.0] read-data error: bad screen distance "100.0d0" postponing event: NIL postponing event: NIL postponing event: NIL postponing event: NIL postponing event: NIL postponing event: NIL postponing event: NIL postponing event: NIL ... [C-c C-c] exit Error sending command to wish: Couldn't write to #<SB-SYS:FD-STREAM for "descriptor 7" {B9DB791}>: Broken pipeClosing wish stream: #<TWO-WAY-STREAM :INPUT-STREAM #<SB-SYS:FD-STREAM for "descriptor 8" {B9DC149}> :OUTPUT-STREAM #<SB-SYS:FD-STREAM for "descriptor 7" {B9DB791}>> Closing wish stream: #<TWO-WAY-STREAM :INPUT-STREAM #<SB-SYS:FD-STREAM for "descriptor 8" {B9DC149}> :OUTPUT-STREAM #<SB-SYS:FD-STREAM for "descriptor 7" {B9DB791}>>
Hello Tobias,
I hope all the problems with double floats are sorted out with the new LTk release - if not, please let me know. Peter