On Jan 4, 2005, at 7:42 PM, whamoo wrote:
On 04/gen/05, at 19:33, Bob Ippolito wrote:
I've tried xcode template, but if I modify the AppDelegate nib and add the function in python file, it give me this error:
Could not connect the action change_: to target of class provaDocument
Did you actually write "change_:" as the selector? That's not how it works. Underscores are used from Python and colons are used from Objective-C. Maybe you should read <http://pyobjc.sourceforge.net/doc/intro.php>. The selector should be named "change:" in this case. Also, your source example does not define any class named "provaDocument".
Sorry, my mail was a little confusing, I'm able to build working program with nib starting by interface builder, in this case all works fine, no problem pyobjc is great, but I'm not able to use xcode template, because I'm so stupid....
Step by step:
I create a new cocoa-python application "hello world"
open MainMenu.nib
click on window
put in the windows a button and a label
ok, then there is a helloworldAppDelegate class in IB and a helloworldAppDelegate.py in xcode
in IB i add two outlet and change: action to helloworldAppDelegate, connect the two outlet to the class and the action to the button.
Save the interface
Go to helloworldAppDelegate.py, inside it i found:
from Foundation import NSLog
from PyObjCTools import NibClassBuilder
NibClassBuilder.extractClasses("MainMenu")
class provaAppDelegate(NibClassBuilder.AutoBaseClass):
def applicationDidFinishLaunching_(self, aNotification):
NSLog( "Application did finish launching." )
I have added:
def change_(self, sender):
print "hello"
Build all, launch and read this:
Could not connect the action change: to target of class helloworldAppDelegate
Well the class names you are talking about are different from the class name defined in that Python file. Where the heck is this "prova" coming from? I have no idea what you are doing or not doing. I am sorry but I do not know how to help you.
Note that there was a bug at some point with Xcode projects that have a space in their name, but I thought that got fixed. I rarely ever use the Xcode template personally, they mostly just get in my way and cause extra maintenance hassle.
-bob
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig