用 Python 3 编写 Cocoa 应用程序

发布于 2024-08-06 02:51:44 字数 143 浏览 1 评论 0原文

看起来 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

宛菡 2024-08-13 02:51:44

对于成熟的 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 :=)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文