Hi there,
I cannot figure out how to use canvas. I JUST DO NOT KNOW WHERE TO LOOK FOR THE ANSWER
LTK> (let* (;;(f (make-instance 'frame)) (c (make-instance 'canvas :width WIDTH :height HEIGHT)) (line (create-line c 20 20 40 40)) ;;(pack f) (pack c) ;;(itemconfigure c line arrow first) ;; HOW TO MAKE IT WORK !!!!!!!!!!!!!!! )) ; in: ; LET* ((C (MAKE-INSTANCE 'CANVAS :WIDTH WIDTH :HEIGHT HEIGHT)) ; (LINE (CREATE-LINE C 20 20 40 40)) (PACK C)) ; (LTK:CREATE-LINE LTK::C 20 20 40 40) ; ; caught STYLE-WARNING: ; The function was called with five arguments, but wants exactly two.
; (LET* ((LTK::C ; (MAKE-INSTANCE 'LTK:CANVAS :WIDTH LTK::WIDTH :HEIGHT LTK::HEIGHT)) ; (LTK::LINE (LTK:CREATE-LINE LTK::C 20 20 40 40)) ; (LTK:PACK LTK::C)) ; ) ; ; caught STYLE-WARNING: ; The variable LINE is defined but never used. ; ; caught STYLE-WARNING: ; The variable PACK is defined but never used. ; ; compilation unit finished ; caught 3 STYLE-WARNING conditions ; Evaluation aborted on #<SB-INT:SIMPLE-PROGRAM-ERROR "invalid number of arguments: ~S" {1003704743}>.
Here is another one.
If you run the following you get a strange error
(defun 0-ltk-test () (with-ltk (:serve-event t) (let ((sc (make-instance 'scrolled-canvas))) (create-line sc '(10 10 20 20)) (pack sc :expand 1 :fill :both) )))
The value NIL is not of type STREAM when binding STREAM [Condition of type TYPE-ERROR]
BEST
On 11/7/20, igor denisov saufesma@gmail.com wrote:
Hi there,
Here is another one.
If you run the following you get a strange error
(defun 0-ltk-test () (with-ltk (:serve-event t) (let ((sc (make-instance 'scrolled-canvas))) (create-line sc '(10 10 20 20)) (pack sc :expand 1 :fill :both) )))
The value NIL is not of type STREAM when binding STREAM [Condition of type TYPE-ERROR]
On 11/7/20, igor denisov saufesma@gmail.com wrote:
I cannot figure out how to use canvas. I JUST DO NOT KNOW WHERE TO LOOK FOR
LTK> (let* (;;(f (make-instance 'frame)) (c (make-instance 'canvas :width WIDTH :height HEIGHT)) (line (create-line c 20 20 40 40)) ;;(pack f) (pack c) ;;(itemconfigure c line arrow first) ;; HOW TO MAKE IT WORK !!!!!!!!!!!!!!! )) ; in: ; LET* ((C (MAKE-INSTANCE 'CANVAS :WIDTH WIDTH :HEIGHT HEIGHT)) ; (LINE (CREATE-LINE C 20 20 40 40)) (PACK C)) ; (LTK:CREATE-LINE LTK::C 20 20 40 40) ; ; caught STYLE-WARNING: ; The function was called with five arguments, but wants exactly two.
; (LET* ((LTK::C ; (MAKE-INSTANCE 'LTK:CANVAS :WIDTH LTK::WIDTH :HEIGHT LTK::HEIGHT)) ; (LTK::LINE (LTK:CREATE-LINE LTK::C 20 20 40 40)) ; (LTK:PACK LTK::C)) ; ) ; ; caught STYLE-WARNING: ; The variable LINE is defined but never used. ; ; caught STYLE-WARNING: ; The variable PACK is defined but never used. ; ; compilation unit finished ; caught 3 STYLE-WARNING conditions ; Evaluation aborted on #<SB-INT:SIMPLE-PROGRAM-ERROR "invalid number of arguments: ~S" {1003704743}>.
BEST
I think you want something like this?
(ltk:with-ltk () (let ((c (make-instance 'ltk:canvas))) (ltk:pack c) (make-instance 'ltk:canvas-line :coords '(20 20 40 40) :canvas c)))
On Sat, 7 Nov 2020 17:18:23 -0500, igor denisov saufesma@gmail.com wrote:
Hi there,
I cannot figure out how to use canvas. I JUST DO NOT KNOW WHERE TO LOOK FOR THE ANSWER
LTK> (let* (;;(f (make-instance 'frame)) (c (make-instance 'canvas :width WIDTH :height HEIGHT)) (line (create-line c 20 20 40 40)) ;;(pack f) (pack c) ;;(itemconfigure c line arrow first) ;; HOW TO MAKE IT WORK !!!!!!!!!!!!!!! )) ; in: ; LET* ((C (MAKE-INSTANCE 'CANVAS :WIDTH WIDTH :HEIGHT HEIGHT)) ; (LINE (CREATE-LINE C 20 20 40 40)) (PACK C)) ; (LTK:CREATE-LINE LTK::C 20 20 40 40) ; ; caught STYLE-WARNING: ; The function was called with five arguments, but wants exactly two.
; (LET* ((LTK::C ; (MAKE-INSTANCE 'LTK:CANVAS :WIDTH LTK::WIDTH :HEIGHT LTK::HEIGHT)) ; (LTK::LINE (LTK:CREATE-LINE LTK::C 20 20 40 40)) ; (LTK:PACK LTK::C)) ; ) ; ; caught STYLE-WARNING: ; The variable LINE is defined but never used. ; ; caught STYLE-WARNING: ; The variable PACK is defined but never used. ; ; compilation unit finished ; caught 3 STYLE-WARNING conditions ; Evaluation aborted on #<SB-INT:SIMPLE-PROGRAM-ERROR "invalid number of arguments: ~S" {1003704743}>.
Here is another one.
If you run the following you get a strange error
(defun 0-ltk-test () (with-ltk (:serve-event t) (let ((sc (make-instance 'scrolled-canvas))) (create-line sc '(10 10 20 20)) (pack sc :expand 1 :fill :both) )))
The value NIL is not of type STREAM when binding STREAM [Condition of type TYPE-ERROR]
BEST
On 11/7/20, igor denisov saufesma@gmail.com wrote:
Hi there,
Here is another one.
If you run the following you get a strange error
(defun 0-ltk-test () (with-ltk (:serve-event t) (let ((sc (make-instance 'scrolled-canvas))) (create-line sc '(10 10 20 20)) (pack sc :expand 1 :fill :both) )))
The value NIL is not of type STREAM when binding STREAM [Condition of type TYPE-ERROR]
On 11/7/20, igor denisov saufesma@gmail.com wrote:
I cannot figure out how to use canvas. I JUST DO NOT KNOW WHERE TO LOOK FOR
LTK> (let* (;;(f (make-instance 'frame)) (c (make-instance 'canvas :width WIDTH :height HEIGHT)) (line (create-line c 20 20 40 40)) ;;(pack f) (pack c) ;;(itemconfigure c line arrow first) ;; HOW TO MAKE IT WORK !!!!!!!!!!!!!!! )) ; in: ; LET* ((C (MAKE-INSTANCE 'CANVAS :WIDTH WIDTH :HEIGHT HEIGHT)) ; (LINE (CREATE-LINE C 20 20 40 40)) (PACK C)) ; (LTK:CREATE-LINE LTK::C 20 20 40 40) ; ; caught STYLE-WARNING: ; The function was called with five arguments, but wants exactly two.
; (LET* ((LTK::C ; (MAKE-INSTANCE 'LTK:CANVAS :WIDTH LTK::WIDTH :HEIGHT LTK::HEIGHT)) ; (LTK::LINE (LTK:CREATE-LINE LTK::C 20 20 40 40)) ; (LTK:PACK LTK::C)) ; ) ; ; caught STYLE-WARNING: ; The variable LINE is defined but never used. ; ; caught STYLE-WARNING: ; The variable PACK is defined but never used. ; ; compilation unit finished ; caught 3 STYLE-WARNING conditions ; Evaluation aborted on #<SB-INT:SIMPLE-PROGRAM-ERROR "invalid number of arguments: ~S" {1003704743}>.
BEST
Hi Igor,
I'd never used canvas before, but I took the tutoial here: https://tkdocs.com/tutorial/canvas.html
And ported it to lisp:
(defun sketch () (ltk:with-ltk () (let ((c (make-instance 'ltk:canvas)) lastx lasty) (flet ((add-line (x y) (make-instance 'ltk:canvas-line :canvas c :coords (list lastx lasty x y)) (setf lastx x lasty y))) (ltk:grid c 0 0 :sticky "nwes") (ltk:grid-columnconfigure ltk:*tk* 0 :weight 1) (ltk:grid-rowconfigure ltk:*tk* 0 :weight 1) (ltk:bind c "<1>" (lambda (e) (setf lastx (ltk:event-x e) lasty (ltk:event-y e)))) (ltk:bind c "<B1-Motion>" (lambda (e) (add-line (ltk:event-x e) (ltk:event-y e))))))))
Hope that helps, Jason
On Sun, 8 Nov 2020 22:13:26 -0800, Jason Miller jason@milr.com wrote:
I think you want something like this?
(ltk:with-ltk () (let ((c (make-instance 'ltk:canvas))) (ltk:pack c) (make-instance 'ltk:canvas-line :coords '(20 20 40 40) :canvas c)))
On Sat, 7 Nov 2020 17:18:23 -0500, igor denisov saufesma@gmail.com wrote:
Hi there,
I cannot figure out how to use canvas. I JUST DO NOT KNOW WHERE TO LOOK FOR THE ANSWER
LTK> (let* (;;(f (make-instance 'frame)) (c (make-instance 'canvas :width WIDTH :height HEIGHT)) (line (create-line c 20 20 40 40)) ;;(pack f) (pack c) ;;(itemconfigure c line arrow first) ;; HOW TO MAKE IT WORK !!!!!!!!!!!!!!! )) ; in: ; LET* ((C (MAKE-INSTANCE 'CANVAS :WIDTH WIDTH :HEIGHT HEIGHT)) ; (LINE (CREATE-LINE C 20 20 40 40)) (PACK C)) ; (LTK:CREATE-LINE LTK::C 20 20 40 40) ; ; caught STYLE-WARNING: ; The function was called with five arguments, but wants exactly two.
; (LET* ((LTK::C ; (MAKE-INSTANCE 'LTK:CANVAS :WIDTH LTK::WIDTH :HEIGHT LTK::HEIGHT)) ; (LTK::LINE (LTK:CREATE-LINE LTK::C 20 20 40 40)) ; (LTK:PACK LTK::C)) ; ) ; ; caught STYLE-WARNING: ; The variable LINE is defined but never used. ; ; caught STYLE-WARNING: ; The variable PACK is defined but never used. ; ; compilation unit finished ; caught 3 STYLE-WARNING conditions ; Evaluation aborted on #<SB-INT:SIMPLE-PROGRAM-ERROR "invalid number of arguments: ~S" {1003704743}>.
Here is another one.
If you run the following you get a strange error
(defun 0-ltk-test () (with-ltk (:serve-event t) (let ((sc (make-instance 'scrolled-canvas))) (create-line sc '(10 10 20 20)) (pack sc :expand 1 :fill :both) )))
The value NIL is not of type STREAM when binding STREAM [Condition of type TYPE-ERROR]
BEST
On 11/7/20, igor denisov saufesma@gmail.com wrote:
Hi there,
Here is another one.
If you run the following you get a strange error
(defun 0-ltk-test () (with-ltk (:serve-event t) (let ((sc (make-instance 'scrolled-canvas))) (create-line sc '(10 10 20 20)) (pack sc :expand 1 :fill :both) )))
The value NIL is not of type STREAM when binding STREAM [Condition of type TYPE-ERROR]
On 11/7/20, igor denisov saufesma@gmail.com wrote:
I cannot figure out how to use canvas. I JUST DO NOT KNOW WHERE TO LOOK FOR
LTK> (let* (;;(f (make-instance 'frame)) (c (make-instance 'canvas :width WIDTH :height HEIGHT)) (line (create-line c 20 20 40 40)) ;;(pack f) (pack c) ;;(itemconfigure c line arrow first) ;; HOW TO MAKE IT WORK !!!!!!!!!!!!!!! )) ; in: ; LET* ((C (MAKE-INSTANCE 'CANVAS :WIDTH WIDTH :HEIGHT HEIGHT)) ; (LINE (CREATE-LINE C 20 20 40 40)) (PACK C)) ; (LTK:CREATE-LINE LTK::C 20 20 40 40) ; ; caught STYLE-WARNING: ; The function was called with five arguments, but wants exactly two.
; (LET* ((LTK::C ; (MAKE-INSTANCE 'LTK:CANVAS :WIDTH LTK::WIDTH :HEIGHT LTK::HEIGHT)) ; (LTK::LINE (LTK:CREATE-LINE LTK::C 20 20 40 40)) ; (LTK:PACK LTK::C)) ; ) ; ; caught STYLE-WARNING: ; The variable LINE is defined but never used. ; ; caught STYLE-WARNING: ; The variable PACK is defined but never used. ; ; compilation unit finished ; caught 3 STYLE-WARNING conditions ; Evaluation aborted on #<SB-INT:SIMPLE-PROGRAM-ERROR "invalid number of arguments: ~S" {1003704743}>.
BEST