Using python I am wanting to post a message to the OSX Notification Center. What library do I need to use? should i write a program in objective-c and then call that progra
Here is a way (You need the Foundation module):
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
class Notification():
def notify(self, _title, _message, _sound = False):
self._title = _title
self._message = _message
self._sound = _sound
self.notification = NSUserNotification.alloc().init()
self.notification.setTitle_(self._title)
self.notification.setInformativeText_(self._message)
if self._sound == True:
self.notification.setSoundName_(NSUserNotificationDefaultSoundName)
center = NSUserNotificationCenter.defaultUserNotificationCenter()
center.deliverNotification_(self.notification)
N = Notification()
N.notify(_title="SOME", _message="Something", _sound=True)
This works only for MAC. Hope you enjoy!