Đây là một giải pháp khác hoạt động với Growl 1.2. Tôi không có 1,3 để thử nghiệm. Nó tốt hơn so với hầu hết các giải pháp nổi xung quanh bởi vì bạn không phải bật mạng growl.
Từ http://wiki.python.org/moin/MacPython/Growl/AppleScriptSupport:
$ pip install appscript
và chạy này:
from appscript import *
# connect to Growl
growl = app('GrowlHelperApp')
# Make a list of all the notification types
# that this script will ever send:
allNotificationsList = ['Test Notification', 'Another Test Notification']
# Make a list of the notifications
# that will be enabled by default.
# Those not enabled by default can be enabled later
# in the 'Applications' tab of the growl prefpane.
enabledNotificationsList = ['Test Notification']
# Register our script with growl.
# You can optionally (as here) set a default icon
# for this script's notifications.
growl.register(
as_application='Growl Appscript Sample',
all_notifications=allNotificationsList,
default_notifications=enabledNotificationsList,
icon_of_application='PythonIDE')
# Send a Notification...
growl.notify(
with_name='Test Notification',
title='Test Notification',
description='This is a test Appscript notification.',
application_name='Growl Appscript Sample')
# You can optionally add an icon by adding one of these as the last arg:
# icon_of_application="Script Editor.app")
# icon_of_file="file:///Users/someone/Growl")
# image_from_location="file:///Users/someone/pictures/stopWatch.png")
# Another one...
growl.notify(
with_name='Another Test Notification',
title='Another Test Notification :) ',
description='Alas - you won\'t see me until you enable me...',
application_name='Growl Appscript Sample')
Nguồn
2013-03-17 05:31:30
Thông báo lỗi? Stacktrace? Hay là nó không hoạt động? – BluePeppers
Chỉ cần không làm việc: ( –
Bit thông tin thêm.Tôi đã thử cùng một mã trên OSX Lion chạy Growl 1.2.2 và nó hoạt động hoàn hảo.Nhưng vẫn không có may mắn với Growl 1.3.3.Có những ràng buộc python thay đổi? –