"Sean McIlroy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > There's something quite simple I'd like to do, but I'm hampered by > lack of knowledge regarding Tkinter. If someone could help me out with > a snippet of maximally-simple code showing, in general terms, how to > do this, that would be really great. What I want to do is simply to > move a shape around on the screen using the mouse. I've looked at > Tkdnd.py but I can't seem to extract what I need from the more > involved stuff in there. > > Peace, > STM
Use Canvas.move(). Here is some code from a program of mine that may give you an idea of how to go about this. In my case each component consisted of several pieces, each having a unique tag. If they had had the same tag only one move command would have been needed. self.xLast and self.yLast need to be initialized to the current cursor position before the move starts. def onMouseMotion(self, event): x, y = event.x, event.y dx = x - self.xLast dy = y - self.yLast for c in self.selectedComponents: for k in range(c.count): self.canvas.move(c.tags[k], dx, dy) # Move each piece of the component self.xLast, self.yLast = x, y -- http://mail.python.org/mailman/listinfo/python-list