Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 2, 2007, 08:56 PM   #1
Monkaaay
macrumors 6502
 
Join Date: Jun 2006
Location: Richmond, VA
Any tutorials out there for Python/Cocoa in xcode 3 yet?

I'm hoping to find some good information on Python/Cocoa specific to xcode 3.
Monkaaay is offline   0 Reply With Quote
Old Nov 4, 2007, 07:26 AM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
I'm sure there's info on developer.apple.com. You can also find examples in /Developer/Examples/Python
kainjow is offline   0 Reply With Quote
Old Jun 5, 2008, 02:52 PM   #3
credford
macrumors newbie
 
Join Date: Jun 2008
No Good XCode 3 Python Tutorials

Quote:
Originally Posted by kainjow View Post
I'm sure there's info on developer.apple.com. You can also find examples in /Developer/Examples/Python
This isn't true. All that you can find on developer.apple.com and /Developer/Examples/Python are PyObjC examples, not XCode 3 examples. And for a beginner those are two completely different things.

It is incredibly frustrating because there are a ton of tutorials for PyObjC without XCode and a ton of tutorials for XCode 3 with Objective C but no freaking tutorials or examples using the Cocoa-Python template in XCode 3. It is very different than using either PyObjC or XCode with Objective C. Nothing you do in them works with a Cocoa-Python XCode project.

And so, I am screwed (I've been trying to get a simple button application to work for 2 days)..
credford is offline   0 Reply With Quote
Old Jul 13, 2008, 12:24 AM   #4
trewitt
macrumors newbie
 
Join Date: Jul 2002
The PyObjC "PyAverager" tutorial comes close

http://developer.apple.com/cocoa/pyobjc.html
It has nice, reassuring videos of key operations. Most of the explanations are about how objects and operations are handled and translated by the bridge. Those parts are unchanged.

With a few caveats:
  1. I forgot where I learned this, but main.py starts out missing the import for your module(s). Specifically, I had to add the line:
    # import modules containing classes required to start application and load MainMenu.nib
    import MyAveragerAppDelegate
    import Averager # I had to add this line
  2. In Xcode 2, the user interface definition lives in the a .nib file. In Xcode 3, this changes to .xib.
  3. The biggest difference is Interface Builder. The old one just had a little pallet of exemplars you'd drag over (seen in the video). Interface Builder 3 has a huge pallet of objects, and (for a newbie) it's hard to find the right ones. For the example, all of the objects you want are NSTextFields. There are several different flavors (not subclasses, just initial settings, AFAICT) that are initialized for different uses. For example, you want "Label" for the two labels and two output fields, and you want a "Text Field Cell" for the input field.
  4. But, even with that, I can't get PyAverager to work. I get errors that "this class is not key value coding-compliant for the key numbersInput" (and the two output fields, as well). I will start a new thread about that issue.

You can download Apple's PyAverager source and it works fine - although it uses the old .nib file, not .xib.
trewitt is offline   0 Reply With Quote
Old Mar 24, 2009, 10:20 PM   #5
xster
macrumors newbie
 
Join Date: Nov 2008
yup. Same error for me. I actually made an effort to understand Objective-C but it just looks like a mess. Python is way cleaner. I'm used to programming in Windows where ironically, there's more choice and ways to use high level languages like c# to make nice programs.
xster is offline   0 Reply With Quote
Old Mar 24, 2009, 10:23 PM   #6
Cromulent
macrumors 603
 
Cromulent's Avatar
 
Join Date: Oct 2006
Location: The Land of Hope and Glory
Quote:
Originally Posted by credford View Post
This isn't true. All that you can find on developer.apple.com and /Developer/Examples/Python are PyObjC examples, not XCode 3 examples. And for a beginner those are two completely different things.
In that case there is no need for Xcode really.

Just download Smultron and read the Python documentation over at http://www.python.org/ and get stuck in. Leave Xcode for when you know the language and actually need it.

Quote:
Originally Posted by xster View Post
yup. Same error for me. I actually made an effort to understand Objective-C but it just looks like a mess. Python is way cleaner. I'm used to programming in Windows where ironically, there's more choice and ways to use high level languages like c# to make nice programs.
C# is available on the Mac too. Just look at the Mono Project.

Mac OS X is probably the best development platform out there as it has access to all the good things in Unix as well as the more consumer orientated background of the Mac OS.

Edit: Bah, I wish people wouldn't bump old threads .
__________________
Neural Advance - Mac OS X, UNIX and Windows Development
Last.fm Profile | Extreme Metal Reviews
MP 4x 2.66Ghz Xeons / 6GB RAM / 640GB + 500GB + 750GB + 1TB HDDs / ATI Radeon 4870 / iPad 3
Cromulent is offline   0 Reply With Quote
Old Mar 24, 2009, 10:38 PM   #7
GorillaPaws
macrumors 6502a
 
GorillaPaws's Avatar
 
Join Date: Oct 2003
Location: Richmond, VA
Quote:
Originally Posted by xster View Post
I actually made an effort to understand Objective-C but it just looks like a mess.
Was it the Objective-C that was so messy for you? or was it the Foundation Framework/Cocoa stuff that you had issues with?
GorillaPaws is offline   0 Reply With Quote
Old Mar 26, 2009, 12:49 PM   #8
trewitt
macrumors newbie
 
Join Date: Jul 2002
Still Interested...

I'm still interested, in fact.
And, I still haven't found any resources out there. It's pretty frustrating, since the old examples, when PyObjC wasn't part of Xcode.
trewitt is offline   0 Reply With Quote
Old Mar 26, 2009, 01:14 PM   #9
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
I might be able to whip up a tutorial or something. I don't really know Python but I was able to create a new project and added a button that beeps.

There is an older tutorial here which might help, but it uses an older version of Xcode.

Edit: been messing around a bit with this. Python is a royal PITA. Didn't realize how much of a whitespace Nazi it was. It is nice for keeping the amount of code down, but requires more work in IB than Objective-C and those extra underscores are getting annoying quickly

Last edited by kainjow; Mar 26, 2009 at 02:21 PM.
kainjow is offline   0 Reply With Quote
Old Mar 26, 2009, 08:52 PM   #10
trewitt
macrumors newbie
 
Join Date: Jul 2002
Python not so bad for me...

Python I can handle. KeyValueBindings and Controllers - those are mysterious and opaque.

The problem with something that's supposed to "just work" is that you're totally high and dry when it doesn't. Sigh.
trewitt is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Xcode or cocoa? Pajamaxllama iPhone/iPad Programming 9 Oct 22, 2013 09:01 AM
Moving from xcode 3.2 to xcode 4.5.2 compilation error for 'abs' macro in stdlib.h hrishidev Mac Programming 7 Jun 2, 2013 10:36 AM
XCode - Cocoa-applescript question djjasonsa Mac Programming 3 Feb 21, 2013 03:50 PM
XCode 4.4.1 to Xcode 4.5 in Mountain Lion VinegarTasters OS X 10.8 Mountain Lion 2 Sep 19, 2012 08:55 PM

Forum Jump

All times are GMT -5. The time now is 09:26 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC