Snow Leopard 上的 PyObjc 和 Cocoa

发布于 2024-08-03 16:20:03 字数 1002 浏览 4 评论 0原文

我即将开始我的 A 级计算项目(高中级别),该项目有望成为 Mac 操作系统的销售点应用程序。不幸的是,目前 Objective-C 有点超出我的能力范围,如果我在项目中陷入困境,我没有人可以帮助,所以我可能会不及格这门课程,也无法进入大学。所以这对我来说非常重要。

我想使用 Python 开发一个 Cocoa 应用程序。我知道我需要 PyObjc,但是网上的所有详细信息似乎都假设它是预先安装的。显然 Leopard 和 Snow Leopard 就是这种情况,但我似乎在 Snow Leopard 上没有它,也从未在 Leopard 上注意到它。另外,我尝试按照 Sourceforge 页面上的说明安装 PyObjc 的最新测试版,但没有成功。

如果有人能够阐明需要安装什么、如何安装以及可以帮助我的任何资源或教程的链接,我将非常感激。

预先感谢您的帮助!

更新:我发现这是一个热门问题,我刚刚获得了“值得注意的问题”徽章,所以我想我会向访问此页面的任何人更新我在得到答案后所做的事情。

不幸的是,我无法使用 Python 创建 Mac 应用程序。这在当时是相当令人失望的,但可能是一件好事。我用 C# 为我的项目制作了一个 Windows 应用程序,它是一个用于在模拟环境中创建和运行程序集应用程序的工具。我的课程老师现在开始使用我的工具而不是他自己的工具来教授课程!我在计算机项目上获得了非常高的分数(超过 90%),这有助于我在计算机 A-Level 中获得 A*(可获得的最高等级),因此我进入南安普顿大学学习计算机科学。

今年夏天,我决定制作一个 iPad 应用程序(即将发布),我很高兴地说我知道我可以用 Objective-C 制作一个 Mac OS 应用程序,因为我觉得我已经学得足够多了。我很高兴我花时间学习它,它是一门很棒的语言,并且在 iOS 变得如此流行的情况下非常有用。

很抱歉所有的自夸,但我真的很高兴。我真正想说的是,如果您来到此页面希望使用 PyObjc 轻松创建 Mac 应用程序,请不要打扰。这需要一些时间和精力,但是一旦你学会了 Objective-C,用它创建应用程序真的很令人满意。祝你好运!

I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course and not get into University. So this is quite important to me.

I want to use Python to develop a Cocoa app. I know that I need PyObjc, however all details on the net seem to assume it is pre-installed. Apparently this is the case with Leopard and Snow Leopard but I don't seem to have it on Snow Leopard and never noticed it on Leopard. Also, I have tried installing the latest beta of PyObjc by following the instructions on the Sourceforge page, but with no luck.

I would really appreciate it if anyone could shed some light on what needs to be installed, how, and links to any resources or tutorials that could help me.

Thanks in advance for the help!

Update: I see that this is a popular question, I just got the 'Notable Question' badge for it so I thought I would update anyone coming to this page on what I did after getting the answers.

Unfortunately, I wasn't able to use Python to create a Mac application. This was rather disappointing at the time, but probably a good thing. I made a Windows app in C# for my project, it was a tool for creating and running Assembly apps in a simulated environment. My course teacher has now started to use my tool to teach the course instead of his own! I got a very high score on the computing project (over 90%) and this contributed to me getting an A* in my computing A-Level (the highest grade available) and I consequently got in to Southampton University to study Computer Science.

This summer, I decided to make an iPad app (soon to be released) and I am glad to say that I know think I could make a Mac OS application in Objective-C as I feel I have learnt enough. I am glad that I took the time to learn it, it is a great language and really useful with iOS becoming so popular.

Sorry for all the boasting, but I am really happy about it. What I really want to say is, if you are coming to this page hoping to use PyObjc to create Mac apps easily, don't bother. It takes some time and some effort, but once you have learnt Objective-C, it is really satisfying to create apps with it. Good Luck!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(6

惟欲睡 2024-08-10 16:20:03

请允许我重复已经说过的话。我也是一个刚开始 Cocoa 开发项目的学生,一开始我想“好吧,我已经了解 Python,我就使用 PyObjC 就可以了,这样就不用学习 Objective-C了,这超出了我的掌握范围。 ”我很快就知道这是不可能的。您可以在不学习 Objective-C 的情况下进行 OS X 开发,但不能不学习 Cocoa 库,这些库构成了您在 Objective-C 中编写 Cocoa 应用程序所需学习的 99%。 Objective-C 本身并不难;您需要投资学习的是 Cocoa 库。

PyObjC 基本上使用 Cocoa 库和 Python 语法。我很快就放弃了,并决定如果我必须学习 Cocoa,我不妨使用 Objective-C。

如果您想学习,Aaron Hillegass 的书是一个不错的起点。祝你好运!

Allow me to echo what has already been said. I too am a student who just started a Cocoa development project, and at the beginning I thought "Well, I already know Python, I'll just use PyObjC and save myself from having to learn Objective-C, which looks beyond my grasp." I learned quickly that it can't be done. You can develop for OS X without learning Objective-C, but not without learning the Cocoa libraries, which constitute 99% of what you need to learn to write a Cocoa app in Objective-C. Objective-C itself isn't that hard; it's the Cocoa libraries that you need to invest in learning.

PyObjC basically uses Cocoa libraries and Python syntax. I gave up with it quickly and decided that if I was going to have to learn Cocoa, I may as well use Objective-C.

If you're looking to learn, Aaron Hillegass's book is a good place to start. Good luck!

不忘初心 2024-08-10 16:20:03

您的意思是像结账? :-) 我之所以提到它,是因为 Checkout 非常漂亮,并且是用 PyObjC 编写的...

您的担忧是合理的,尽管可能不像您想象的那样具有潜在的破坏性。使用 PyObjC 仍然需要您学习一些 Objective-C,并且肯定需要您至少了解一些 Cocoa 框架,因为每当您需要执行某种特定于 Cocoa 的任务时,您都需要调用 Cocoa 框架。

我建议您阅读并考虑 SO 问题 “为什么 PyObjC 文档如此糟糕?”“用于 Mac 开发的 PyObjc 与 RubyCocoa:哪个更成熟?” 在您完全说服自己“仅使用 PyObjC”会让事情变得更容易之前。我拒绝贬低 PyObjC,因为它非常强大且非常有用,但我意识到没有什么是灵丹妙药,没有一种语言或技术能够解决所有问题。

Objective-C 语言简单明了。 Cocoa 框架通常主导新 Cocoa 程序员的学习曲线。另外,您还可以使用 StackOverflow 和许多其他资源来帮助回答您的问题。 (从 "pyobjc" 标签 的活动来看,您也有更好的机会获得良好的Objective-C 帮助。)

You mean like Checkout? :-) I only mention it because Checkout is gorgeous and written with PyObjC...

Your concerns are valid, although probably not as much of a potential showstopper as you'd think. Using PyObjC still requires you to learn some Objective-C, and definitely requires you to understand at least some of the Cocoa frameworks, since you need to call into the Cocoa frameworks whenever you need to do some sort of Cocoa-specific task.

I recommend you read and consider the SO question "Why is the PyObjC documentation so bad?" and "PyObjc vs RubyCocoa for Mac development: Which is more mature?" before you completely convince yourself that "just PyObjC" will make things much easier. I refuse to disparage PyObjC because it is quite powerful and incredibly useful, but realize that nothing is a silver bullet, and no language or technology is best for all problems.

The Objective-C language is simple and pretty straightforward. The Cocoa frameworks generally dominate the learning curve for new Cocoa programmers. Plus, you have StackOverflow and lots of other resources to help answer your questions. (Judging by the activity of the "pyobjc" tag, you also stand a better chance of getting good Objective-C help on SO.)

盗琴音 2024-08-10 16:20:03

作为 Checkout 开发人员之一,我也会参与其中(嗨 Quinn!)。从我们所见,PyObjC 在 Snow Leopard 上运行得相当好。我们已经在 Leopard 上构建了最新的 SVN 修订版 2.2b 之一,并进行了一些自定义,并且刚刚移至 site-packages 文件夹。

理论上,您应该能够使用内置的 Python/PyObjC (只需导入 objc、Foundation、AppKit),但当我们发布/使用 Python 和 PyObjC 的自定义版本时,我不确定状态到底是什么。邮件列表没有提到很多人有问题(只有少数),所以这可能是一个好兆头。

祝项目顺利,如果您有具体的 POS 问题,请给我发送电子邮件;-)

And as one of the Checkout developers I'll weigh in too (hi Quinn!). From what we've seen PyObjC runs fairly well on Snow Leopard. We've built one of the latest SVN revisions 2.2b with some customizations on Leopard and just moved over the site-packages folder.

Theoretically you should be able to use the built in Python/PyObjC (just do import objc, Foundation, AppKit) but as we ship/work with custom versions of both Python and PyObjC I'm not sure what the status exactly is. The mailing list doesn't mention a lot of people having issues (just a few) so that could be a good sign.

Good luck with the project, and if you have specific POS questions shoot me an email ;-)

疯狂的代价 2024-08-10 16:20:03

我自己几乎不使用 PyObjC,但我相信您需要运行 Snow Leopard DVD 上的 Xcode 安装程序才能使用 PyObjC。

另外,正如 Quinn 所说,你需要至少了解一些 Objective-C 才能使用像 PyObjC 这样的 Cocoa 桥而不用费力气。它只是不能完全隔离你。

I hardly use PyObjC myself, but I believe you need to run the Xcode installer on the Snow Leopard DVD in order to use PyObjC.

Also, as Quinn said, you will need to understand at least some Objective-C in order to use a Cocoa bridge like PyObjC without tearing your hair out. It just doesn't insulate you that completely.

天荒地未老 2024-08-10 16:20:03

我同意奎因的观点。即使您已经精通 Python,学习如何连接 Python 和 Cocoa 也不会比学习使用 Objective-C 的 Cocoa 更容易。

Objective-C 是一种简单、干净的语言,很容易掌握。构建 GUI 并将其连接到后端将比学习 Objective-C 编写后端更难,而构建 GUI 并将其连接到后端也不是那么难。

遵循Cocoa 应用程序教程(你应该能够在一天内完成它,或者如果你进展缓慢的话可能需要一个周末)并且你会顺利完成任务。

I'm going to agree with Quinn here. Even if you're already proficient in Python, learning how to interface Python and Cocoa is not going to be any easier than learning Cocoa with Objective-C.

Objective-C is a simple, clean language that is quite easy to grok. Building the GUI and hooking it up to the back-end will be harder than learning the Objective-C to write the back-end, and building the GUI and hooking it up isn't that hard.

Follow the Cocoa app tutorial (you should be able to get through it in a day, or maybe a weekend if you go slow) and you'll be well on your way.

作死小能手 2024-08-10 16:20:03

我是一名长期的 Python 开发人员,现在已经开发 iPhone 应用程序有一段时间了(并且只使用我的 Python 知识在运行脚本中打包应用程序的构建文件),然后开始制作一些 PyObjC 应用程序。

我不得不说,PyObjC 仍然需要学习 Objective C(我已经通过 iPhone 开发知道了),但是如果你使用它,你会得到一些非常酷的好处

  • 轻松使用你知道的 python 库(对你来说更快)
  • 如果受到 Cocoa 的阻碍,可以选择放弃它并转到 wxPython
  • 开发时间更快一些(您编写的代码更少,并且两种语言之间的翻译非常容易习惯)。

此外,相对而言,界面生成器有点难以适应,但如果您是一名 Python 开发人员,无论如何您并不完全习惯功能性 gui 生成器 :oP

I'm a long time python developer who's been doing iPhone apps for awhile now (and only using my python knowledge to package up build files for the apps in run scripts), then who started making some PyObjC apps.

I'd have to say, PyObjC is pretty much STILL having to learn objective C (which I already know via iPhone dev), however you get several pretty cool benefits if you use it instead

  • Easy use of python libraries you know (faster for you)
  • Option to drop it and go to wxPython if styimied by Cocoa
  • Somewhat faster development time (you're writing less code, and the translation between the two languages is pretty darn easy to get used to).

Additionally, interface builder is a little tricky to get used to comparatively speaking, but if you're a python dev, it's not like you're exactly used to a functional gui builder anyhow :oP

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