onMouseMove()

Method that is called when the mouse is moved. This event handler method is fired in the world, in sprites and in tags. In sprites and tags it is only fired when the mouse pointer is actually moved over the content of this element (over what 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 Atlantis(World):
    def onMouseMove(self, event):
    	pass
class ASprite(Sprite):
    def onMouseMove(self, event):
    	pass
class ATag(Tag):
    def onMouseMove(self, event):
    	pass

Relevant examples: mouse.py , ALL

In Context

class Atlantis(World):
    def onSetup(self):
        d = Disc(self, 'tag1')
        d.enableMouseEvents()

    def onMouseMove(self, event):
    	print 'Mouse has been moved to:'
    	print 'x:', event.pos[0]
    	print 'y:', event.pos[1]
    	
class Disc(Tag):
    def onDraw(self):
        disc(200, 200, 100)
        
    def onMouseMove(self, event):
    	print 'Mouse has been moved over the disc.'
Initiated by Stephan Hechenberger
Thanks to CADRE's 103