Writing Cocoa applications in Python 3

自作多情 提交于 2020-02-06 05:26:24

问题


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.


回答1:


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 :=)



来源:https://stackoverflow.com/questions/1514638/writing-cocoa-applications-in-python-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!