onMouseDrag()

Method that is called when the mouse drags an element. Dragging refers to pressing a mouse button down over an element and moving the mouse while still having the button pressed down. This event handler method is fired in sprites and tags when the mouse is dragged from over an element's content (whatever is drawn in the element's onDraw()). Events for sprites and tags have to be enabled when needed by calling enableMouseEvents() on the element.

class ASprite(Sprite):
    def onMouseDrag(self, event):
    	pass
class ATag(Tag):
    def onMouseDrag(self, event):
    	pass

Relevant examples: tag_drag.py , mouse.py , ALL

In Context

class Atlantis(World):
    def onSetup(self):
        d = Disc(self, 'tag1')
        d.enableMouseEvents()
    	
class Disc(Tag):
    def onDraw(self):
        disc(200, 200, 100)
        
    def onMouseDrag(self, event):
    	print 'Mouse wants to drag the disc to:'
    	print 'x:', event.pos[0]
    	print 'y:', event.pos[1]
    	if glo.ia.LMB:
    	    print 'Mouse is dragging with left button.'
    	if glo.ia.MMB:
    	    print 'Mouse is dragging with middle button.'
    	if glo.ia.RMB:
    	    print 'Mouse is dragging with right button.'
    	 
Initiated by Stephan Hechenberger
Thanks to CADRE's 103