On 25/11/2010 6:33 AM, antbucc wrote:
I'm developing an interface for a project where we should move cars
(that are images) from one point in the layout to another point. This
means that, using the mouse, we should be able to move it. To develop
this layout we have used the perl module tkx. Do you know the way to
move them using it? is there some example around that we can take a
look?

You will need to make bindings on the canvas items you create. This is similar to regular widget bindings, except they apply to canvas items and uses the canvas subcommands. You would mark the item for movement on ButtonPress-1 and move it with B1-Motion.

There are Tcl/Tk examples in the standard Tk demo that show moving items on a canvas (along with lots of other canvas features).

The following again are Tcl/Tk examples, but should be easy to translate (let us know if you hit issues):
  http://wiki.tcl.tk/1291 (list of some Tk widget examples on the wiki)
  http://wiki.tcl.tk/884 checkers, which has item movement

Jeff

Reply via email to