用Python 3编写Cocoa应用程序 [英] Writing Cocoa applications in Python 3

查看:164
本文介绍了用Python 3编写Cocoa应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎PyObjC尚未移植到Python 3。

It looks like PyObjC is not ported to Python 3 yet.

同时有没有办法使用Python 3编写Cocoa应用程序?

Meanwhile is there a way to write Cocoa applications using Python 3?

我打算开始一个新的MacOSX GUI应用程序项目,尽管5要使用Python 3.x而不是Python 2.x。

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.

推荐答案

对于成熟的可可,我认为PyObjC几乎是该镇唯一的游戏。如果您是从Python背景而不是从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 :=)

这篇关于用Python 3编写Cocoa应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆