Slashdot Mirror


Write Pure Python Cocoa Apps

bbum writes "Today, Ronald Oussoren and I patched the PyObjC (PythonObj-C) bridge to allow for completely standalone Cocoa applications that are implemented in Python. My 11-Oct-2002 weblog entries provide more detail and includes a link to a PyObjC Cocoa app that can be downloaded and hacked upon (with the app, you can actually create other apps without using the dev tools at all!). As the days pass, I'll be updating the 'blog with new software, updates, etc. A Fink package will be submitted shortly. (In reality -- Ronald did the hard stuff in that he figured out how to subclass ObjC classes in Python!!)" Nifty. Note there is also a PerlObjCBridge module included with Jaguar, and there's also CamelBones for Perl-Cocoa; what other scripting frameworks for Mac OS X are out there?

5 of 30 comments (clear)

  1. If I understand correctly... by Big+Sean+O · · Score: 3, Interesting

    You will be able to write apps in Python (or Perl) and be able to use the Cocoa framework to make stand-alone apps.

    This is different than porting the Tk GUI to Aqua. I know this also is being done for Python.

    I would eventually like both.

    --
    My father is a blogger.
  2. Re:Who cares? by sco08y · · Score: 2, Interesting

    Actually, you can use that as an advantage. Often times employers will ask you to write a "prototype" and then when it's done, they fire you and hire some monkeys to do upgrades.

    If you do prototyping in python and Cocoa, you can be sure that won't happen.

  3. Re:Clarification by bbum · · Score: 4, Interesting

    See, I thought you could even add Objective-C classes while the program was running, as it's totally dynamic.

    Oh -- certainly -- you can always load a bundle. However, redefining existing classes has always been somewhat limited because of the way ObjC is implemented. Not a criticism of the language-- just the nature of its implementation.

    With the Python stuff, it is much easier to effectively redefine everything about a class. This isn't 100% considered within the current implementation, but the potential is there.

  4. Re:Yeah, good, but ... by bdash · · Score: 2, Interesting

    In the context of the article, an Application is a program that runs, has a native GUI, and has an icon in the dock. This has previously not been possible to do with Python under Mac OS X, without 3rd party toolkits such as wxWindows/wxPython.

  5. great news! by Panix · · Score: 5, Interesting

    This is absolutely excellent news! I downloaded this the second I read the article, and I have been playing with it for a few hours now. It works almost flawlessly. The only thing that could really make this better is if Apple picked it up and integrated Python as a first class citizen along with Java and Objective-C in Interface Builder and Project Builder.

    People may ask "what's the point?" Well, for starters, Python is absolutely fantastic for building things quickly, especially for complex object or data structures that would take much more time to implement in Objective-C or Java.

    On top of this, Python is much better suited for Cocoa than Java! Apple implemented the Java-Cocoa bridge mostly for the sake of having Java be a "supported language." But, since Java is inflexible and strongly typed, it doesn't really fit into the Objective-C model that Cocoa relies on. Python on the other hand is perfectly suited for Cocoa. Python is weakly typed and can handle the dynamic runtime of Cocoa a lot better than a language like Java.

    In addition to this, Python's runtime is much more compact than Javas, and manages to load much more quickly. Just fire up Terminal.app and type "python" ... you will see the interactive Python interpreter fire up within a second. Its an amazing little language =)

    I am very excited about the potential of this Python/Cocoa implementation! In the first hour or so since I installed this, I was able to take an existing Python backend and add a quick Cocoa frontend, using nothing but the standard OS X Development Tools.

    Kudos to the great people who developed this!