ENTRY | DOWNLOAD | MANUAL | ONGOING | |
onMouseIn, onMouseOut()Methods that are called when the mouse pointer enters or leaves an element, respectively. These event handler methods are fired in sprites and tags only when the mouse pointer first hits or moves away from the content of a sprite or tag (enters or leaves 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 ASprite(Sprite): def onMouseIn(self, event): pass def onMouseOut(self, event): pass class ATag(Tag): def onMouseIn(self, event): pass def onMouseOut(self, event): pass Relevant examples: tag_drag.py , mouse.py , ALL In Contextclass Atlantis(World): def onSetup(self): d = Disc(self, 'tag1') d.enableMouseEvents() class Disc(Tag): def onDraw(self): disc(200, 200, 100) def onMouseIn(self, event): print 'Element is now under the mouse pointer.' def onMouseOut(self, event): print 'Element is not under the mouse pointer any longer.' |
|
Initiated by Stephan Hechenberger Thanks to CADRE's 103 |