我正在mac osx上用python制作一个应用程序。我正在使用 py2app 从 myapp.py python 脚本文件和 setup.py 制作 myapp.app。在我的 myapp.py 代码中,我使用终端通知器作为
def notify(title, subtitle, message):
t = '-title {!r}'.format(title)
s = '-subtitle {!r}'.format(subtitle)
m = '-message {!r}'.format(message)
os.system('terminal-notifier {}'.format(' '.join([m, t, s])))
notify(
title = 'Title message',
subtitle = 'with python',
message = 'Validating user'
)
安装为后显示通知工作正常sudo gem install terminal-notifier
。我的系统中存在终端通知程序in location /Library/Ruby
。我的问题是how to include this in py2app for developing my app, as py2app is not able to include terminal-notifier in myapp.app
。我的 setup.py 是
from setuptools import setup
APP=['myapp.py']
DATA_FILES= [('',['config.cfg'])]
OPTIONS={'iconfile':'cc.icns','argv_emulation': True,'plist':{'CFBundleShortVersionString':'1.0'}}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app']
)