mouse.py

"""A line's endpoint that follows the mouse.
   by stephan)
"""
from slut import *

class Atlantis(World):
    def onSetup(self):
        self.name = "Mouse"
        self.width = 400
        self.height = 300
        self.xmouse_pos = 200
        self.ymouse_pos = 200

    def onMouseMove(self, event):
        self.xmouse_pos = event.pos[0]
        self.ymouse_pos = event.pos[1]

    def onDrawOrtho(self):
        line(0, 0, 0, self.xmouse_pos, self.ymouse_pos, 0)


atlantis = Atlantis()
atlantis.run()
Initiated by Stephan Hechenberger
Thanks to CADRE's 103