且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用Python 3编写Cocoa应用程序

更新时间:2023-10-21 12:25:34

对于成熟的可可,我认为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 :=)