Xcode 4 上的 PyObjC
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5843508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PyObjC on Xcode 4
提问by Jaliborc
Xcode 3 had templates for building Cocoa subclasses in Python. I've recently upgraded to Xcode 4 but I cannot find out how I can use other languages besides the C family (C, C++, Obj-C) in Xcode 4.
Xcode 3 有用于在 Python 中构建 Cocoa 子类的模板。我最近升级到 Xcode 4,但我不知道如何在 Xcode 4 中使用除 C 系列(C、C++、Obj-C)之外的其他语言。
Does anyone know?
有人知道吗?
采纳答案by jscs
The Python-Cocoa class templates you're looking for are part of PyObjC, but Apple stopped including them in the install around the end of Leopard (I think), because they got out of sync with Xcode. You can download the latest versions yourself from the PyObjC repository. According to this recent guideI found, they should go in ~/Library/Developer/Xcode/Templates/.
您正在寻找的 Python-Cocoa 类模板是 PyObjC 的一部分,但 Apple 在 Leopard 结束时停止将它们包含在安装中(我认为),因为它们与 Xcode 不同步。您可以自己从PyObjC 存储库下载最新版本。根据我发现的这个最近的指南,它们应该进入 ~/Library/Developer/Xcode/Templates/。
Beware, however: according to Ronald Oussoren, PyObjC's developer, the Interface Builder part of Xcode 4 is not at all compatible with PyObjC. He made a posting to the pythonmac mailing listand another to the pyobjc-dev listsuggesting that bugs be filed with Apple, requesting continued Xcode support for the bridge. There's nothing that can be done on either his or your end; Apple has to do this.
但是请注意:根据 PyObjC 的开发人员 Ronald Oussoren 的说法,Xcode 4 的 Interface Builder 部分与 PyObjC 完全不兼容。他在 pythonmac 邮件列表和pyobjc-dev 列表上发了一个帖子,建议向 Apple 提交错误,请求继续为桥接器提供 Xcode 支持。无论是他还是你,都无能为力;苹果必须这样做。
You'll have to keep Xcode 3 around to do PyObjC GUI stuff.
你必须保留 Xcode 3 来做 PyObjC GUI 的东西。
回答by Ferguzz
回答by Mohawke
I've successfully built a MacRuby GUI app in XCode 4.2 on Lion today following a MacRuby tutorial on Apple's site. MacRuby also includes a template in XCode 4.2. I'm a Python programmer and really hoped to use it, but at this point I've given up on PyObjC. I use Tk in Python for quick little apps and maybe switch to MacRuby, but will likely just switch to Objective-c. Ruby is a pretty nice language though. Maybe MacRuby will interest you.
按照 Apple 网站上的 MacRuby 教程,我今天在 Lion 上的 XCode 4.2 中成功构建了一个 MacRuby GUI 应用程序。MacRuby 还在 XCode 4.2 中包含了一个模板。我是一名 Python 程序员,真的很想使用它,但此时我已经放弃了 PyObjC。我在 Python 中使用 Tk 来开发快速的小应用程序,可能会切换到 MacRuby,但可能只会切换到 Objective-c。不过,Ruby 是一种非常好的语言。也许 MacRuby 会让你感兴趣。