用 Python 3 编写 Cocoa 应用程序
看起来 PyObjC 还没有移植到 Python 3。
同时有没有办法使用Python 3 编写Cocoa 应用程序?
我打算启动一个新的 MacOSX GUI 应用程序项目,但希望使用 Python 3.x 而不是 Python 2.x。
It looks like PyObjC is not ported to Python 3 yet.
Meanwhile is there a way to write Cocoa applications using Python 3?
I am intending to start a new MacOSX GUI application project and though5 would want to use Python 3.x instead of Python 2.x.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于成熟的 Cocoa,我认为 PyObjC 几乎是唯一的游戏。如果您是从 Python 背景开始使用 Cocoa,而不是从 Obj-C Cocoa 背景开始使用 Python,那么 Cocoa API 的学习曲线肯定比 Python 2.x 和 Python 之间的差异陡峭 3.x。所以我认为,目前最好的策略是用 Python 2.x 编写应用程序,同时尝试使其尽可能对 Python 3.x 友好,包括定期运行 2to3 作为检查。我确信 PyObjC 补丁来帮助支持 Python 3 将非常受欢迎。如果您只是在寻找简单的 GUI 界面而不是成熟的 Cocoa 应用程序,那么您可能可以调用其他包,例如 CocoaDialog 或 Python 2.x-PyObjC 对话框应用程序 :=)
For full-blown Cocoa, I think PyObjC is pretty much the only game in town. If you are coming to Cocoa from a Python background rather than to Python from an Obj-C Cocoa background, surely the learning curve of the Cocoa APIs is much steeper than the differences between Python 2.x and Python 3.x. So I think, at the moment, the best strategy is writing your app in Python 2.x while trying to make it as Python 3.x friendly as possible, including periodically running 2to3 on it as a check. And I'm sure patches for PyObjC to help with Python 3 support would be very welcome. If you are just looking for simple GUI interfaces rather than a full-blown Cocoa app, you might be able to get by with calls out to other packages like CocoaDialog or a Python 2.x-PyObjC dialog app :=)