Created
October 9, 2015 22:43
-
-
Save typemytype/2578e1e860042d2f6d47 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