Created
January 28, 2013 20:42
-
-
Save rcaldwel/4658815 to your computer and use it in GitHub Desktop.
nifty
This file contains hidden or 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
def notify(title, subtitle=None): | |
"""Display a NSUserNotification on Mac OS X >= 10.8""" | |
from objc import lookUpClass | |
NSUserNotification = lookUpClass('NSUserNotification') | |
NSUserNotificationCenter = lookUpClass('NSUserNotificationCenter') | |
if not NSUserNotification or not NSUserNotificationCenter: | |
return | |
notification = NSUserNotification.alloc().init() | |
notification.setTitle_(str(title)) | |
if subtitle: | |
notification.setSubtitle_(str(subtitle)) | |
notifcation_center = NSUserNotificationCenter.defaultUserNotificationCenter() | |
notifcation_center.scheduleNotification_(notification) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment