SNIP IT: tk.Canvas Drag Items Around

Phlip phlip_cpp at yahoo.com
Thu Jun 20 10:09:29 EDT 2002


Brian Elmegaard wrote:

> I am not very experienced in tkinter, so I would like to understand
> what is the advantage of your solutions compared to what I have in
> Matt Conways example:
> c:/Python22/Demo/tkinter/matt/canvas-moving-w-mouse.py

The advantage is I was unaware of this example.

Reviewing it, I see he uses 'move'; I think I didn't.

        self.draw.move(CURRENT, event.x - self.lastx, event.y - self.lasty)

He correctly adjusts for the mouse location within the object (the 
subtraction) where I think I let the object snick over so its first coord 
is under the mouse point. I have since fixed that in the production code.

However, he does not use canvasx or canvasy. If this example scaled or 
scrolled it would produce funny motions.

-- 
  Phlip
       http://www.greencheese.org/LucidScheming
  --  All analysis and no code makes Jack a dull boy.
      All analysis and no code makes Jack a dull boy.
      All analysis and no code makes Jack a dull boy.  --




More information about the Python-list mailing list