[ltk-user] Erasing things ..

Greg Bennett gwbennett at sentex.ca
Tue Jan 12 21:12:04 UTC 2010

Peter, thanks for the pointers, again. I have now used itemdelete. And I 
looked at ltk.lisp as well as the on-line ltk docs too. The latter 
suggested that
removing things could be accomplished by using  delete  in place of  create.

So I looked at create-line's source, and set up  delete-line using it as 
a model.
Using itemdelete and your comments, I found it worked on a canvas item 
such as results from create-line.

I was, however struck by the way any of these operated. I built 2 
buttons in a canvas,
one labeled Draw, the other Erase, and attached commands to them.

Draw does the obvious: (create-line canvas (list 100 100 200 200)).
Erase in the form (delete-line canvas (list 100 100 200 200)) does nothing.
However, if I crib from your more example in which you create a canvas
and bind (create-line canvas (list 100 100 200 200)) to a symbol - c in your
example- then (delete-line canvas c) attached to the Erase button works.

I (tentatively) conclude that itemdelete and its relatives delete only 
things they can
"know" about. Probably (clearly!) I do not know how to rescue the handle
returned by (create-line ..) other than by binding it to a symbol, which 
may be the
difficulty. But I (tentatively) conclude that things like ltk 
distinguishes between
a "known" line and a set of pixels which form a line in a canvas, but to 
which a
symbol has not been explicitly attached.

Is this a fair comment, may I ask ?
Peter Herth wrote:
> Hi Greg,
> what you are looking for is itemdelete. You can pass it either an
> integer canvas handle
> or a canvas item object. There is also the clear method which removes
> all items from a
> canvas. Though usually I try to reuse canvas items by re- configure -ing.
> HTH,
> Peter
> On Tue, Jan 5, 2010 at 5:58 PM, Greg Bennett <gwbennett at sentex.ca> wrote:
>> Good morning and Happy New Year, all.
>> I have trolled through ltk.lisp in an attempt
>> to discover how to erase things .. lines, rectangles, ovals ..
>> drawn by create-line etc..
>> I was looking for things like erase-line or delete-rectangle, but
>> could not find anything like this. The closest I came to discovering
>> this sort of functionality was the destroy facility, which seems to
>> destroy widgets. In drawing a shape, however, I may do not usually
>> create it explicitly as a widget with an associated symbol to feed to
>> destroy;
>> must I do this under ltk ?
>> More than likely I have simply missed something (sigh).
>> Thanks in advance for any help and advice.
>> Cheers /Greg Bennett
>> _______________________________________________
>> ltk-user site list
>> ltk-user at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/ltk-user
> _______________________________________________
> ltk-user site list
> ltk-user at common-lisp.net
> http://common-lisp.net/mailman/listinfo/ltk-user

More information about the ltk-user mailing list