canvas

Jason Miller jason at milr.com
Mon Nov 9 06:13:26 UTC 2020


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 at 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 at 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 at 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
> >>
> >
> 



More information about the ltk-user mailing list