从标准 Cocoa 应用程序运行 python 代码
我有一个 XCode 项目构建为 Cocoa 单文档应用程序(它不是 Python-Cocoa 应用程序,这不是我想要的)。
我找到的所有文档都假设我想用 Python 编写的代码创建一个 Cocoa 应用程序,但事实并非如此 - 我想要一个标准的 Cocoa 应用程序,它调用 Python 类中的方法。
我可以使用 PyObjC 从文件运行 python 代码,而不用 main.py 文件替换 Cocoa 标准 main.c 吗?
稍后编辑:我知道 Python.framework 但据我所知,我只能通过环境将参数发送到 PyRun_SimpleFile - 我想直接使用桥与 python 代码交换数据。
I have an XCode project built as a Cocoa single document application (it's not a Python-Cocoa application, that is not what I want).
All the documentation I found assumes I want to create a Cocoa application with code written in Python and this is not the case - I want a standard Cocoa application that calls a method out of a Python class.
Can I use PyObjC to run python code from a file without replacing the Cocoa standard main.c with a main.py file?
Later edit: I am aware of Python.framework but as far as I can tell I can only send parameters to PyRun_SimpleFile through the environment - I'd like to use the bridge directly to exchange data with the python code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
google 搜索 embed python Objective C,返回一些链接这可能会引起兴趣,特别是:
A google search for embed python objective C, returns a few links that might be of interest, in particular: