[Pythonmac-SIG] Some question about pyobjc and creating nib based
application...
whamoo
whamoo at rknet.it
Wed Jan 5 01:42:18 CET 2005
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
Then I hit the wall with my face a lot of time....
The same thing using only IB work fine =)
So, where is my stupid error? I've read the documentation =)
Whamoo www.rknet.it
Powered by:
- MacOsX
- Gnu / Linux Debian Sarge
- Amiga Os 3.9
- Milk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2552 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20050105/06f2cb1a/attachment.bin
More information about the Pythonmac-SIG
mailing list