If you create the canvas items with make-instance, you can just bind events to them
Peter
On Fri, Jun 22, 2012 at 5:03 PM, cage cage@katamail.com wrote:
On Thu, Jun 21, 2012 at 05:38:27PM -0400, Jerry Vinokurov wrote:
Hi all,
I'm trying to bind an event to a canvas element, in this case an arc. I create the arc using something like
(let* ((pie-canvas (make-instance 'canvas :height 200 :width 200)) (arc1 (create-arc pie-canvas 0 0 200 200 :start 0 :extent 45)))
and then later inside the let, I would like to bind a button click event to the arc. I have no problem binding to the canvas itself using (bind), and in Python, I can use the tag_bind method of the Canvas class to achieve this. However, I can't figure out the Ltk equivalent, if there is one. Any suggestions would be appreciated.
Not sure this answer your question but ltk have a tagbind (never used it actually).
(ltk:tagbind pie-canvas tag "<ButtonPress-1>" function)
Or you can bind the whole canvas:
(ltk:bind pie-canvas "<ButtonPress-1>" function)
But You should figure out how "function" could search and manage for the clicked arc of course.
Bye. C.
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user