|
|
ADC PyObjC
Apple Developer Connection has published my article: Using PyObjC for Developing Cocoa Applications with Python. Some notes: Python With IronPython and PyObjC, Python seems to be the first nonviral-open-source cross-platform commercial-grade dynamic language that can build truly native desktop applications. It's about bloody time. At one time I thought Java was going to play a similar a role, but that dream died when AWT begat Swing. AWT needed replacing, but Swing killed the high-quality dream. SWT exhumed the corpse, only to dig the grave deeper. It used to be for truly cross-platform code, your choices were C and maybe C++. It appears Python can now be added to that exclusive list. PyObjC is very real; IronPython has Microsoft's support. Python plays well with C, both being able to call it and be called from it. It has a noninsane license. The language is evolving based on an active community. Pinch me. Is there a downside? Ah yes, no ternary operator. Movies The article contains three QuickTime movies that step through the Interface Builder steps. Interface Builder, like WebObjects Builder, is really better explained via screencasting than in text. I supplied the text anyway, but I feel the movies are far easier to understand. The movies are encoded in H.264, which means you'll need QuickTime 7 to play them. If you're stuck using an earlier QuickTime, here's the same movies, encoded using Sorenson 3: Movie 1: Registering and instantiating the Averager class Movie 2: Adding NSTextFields using Interface Builder Movie 3: Binding the active NSTextFields to the Averager Python model object I think those will work back to something like QuickTime 5. H.264 is pretty impressive. Together, these movies are 1.7MB smaller encoded using H.264 versus Sorenson 3 (and Sorenson 3 is nothing to sneeze at). Incidentally, this is the first ADC article that has movies in it (and we have the scars to prove it -- a few issues cropped up that delayed shipping). I don't think it will be the last, either. A lot of tech topics would do better with more cowbell. This article contains "only" three movies. I don't think it makes sense to put stuff like the code overview into a movie -- text is just dandy for that. That said, I view text+screencasts as rather primitive. I think there's a holy union of text, screencasts, animation, dialog and interaction out there, but it would take a ton of work. Example Code The article's example is a little odd. It sprung from a PSIG presentation which started with a pure ObjC application ("ObjCAverager") and was migrated realtime to PyObjC. The intent was to illustrate how ObjC code translated to PyObjC. Thus the translated Python code breaks idioms. For example, Bob Ippolito pointed out I should use a list comprehension to build the list of floats. Here, I erred on the side of nonidiomatic code in the hope it's more accessible to Python newbies. Guido forgive me. Update: I goofed on the included PyAverager project. Unless your disk layout is very similar to mine, the included prebuilt PyAverager.app won't launch for you. It turns out that while I correctly set the project's build configuration to "Deployment", I failed to notice I also needed to switch the active target to "Deployment" to match. You can get the fixed project here. Monday, August 15, 2005
|
Contact Me Topics RSS Feed Linkblog
Bill Bumgarner Brent Simmons Daniel Jalkut Dave Dribin Eric Albert Eric Rescorla Eric Sink Greg Miller Gus Mueller Jeremy Zawodny John Gruber Mark Dalrymple Michael Tsai Peter Ammon Raymond Chen Ryan Wilcox Scott Stevenson Steven Frank The Daily WTF we hates software Wil Shipley |
Copyright © 1997-2008 Jonathan 'Wolf' Rentzsch. All rights reserved.
Questions? Comments? Contact Me.