-
-
Save davelab6/44a569df3f1103fccadf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mojo.events import addObserver | |
from AppKit import NSSound, NSURL | |
path = u"http://soundbible.com/grab.php?id=1995&type=mp3" | |
url = NSURL.URLWithString_(path) | |
sound = NSSound.alloc().initWithContentsOfURL_byReference_(url, False) | |
class SomeMotivation(object): | |
def __init__(self): | |
addObserver(self, "mouseDragged", "mouseDragged") | |
def mouseDragged(self, notification): | |
if sound.isPlaying(): | |
return | |
glyph = notification["glyph"] | |
sel = glyph.selection | |
if len(sel) == 1 and sel[0].type == "offCurve": | |
sound.play() | |
SomeMotivation() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment