Thread: [Pyobjc-dev] How do I learn PyObjC 2 in Leopard?
Brought to you by:
ronaldoussoren
|
From: Jon R. <ch...@gm...> - 2007-12-19 22:28:45
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'd like to use the latest and greatest version of PyObjC, especially since the version provided on the website doesn't seem to even compile on Leopard. I see from Ronald Oussoren's message on Dec 7th that the documentation for PyObjC2 is not on the site yet. Is there documentation anywhere on the net for PyObjC 2? Apple's site doesn't seem to have anything for this either. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: http://firegpg.tuxfamily.org iD8DBQFHaZsCvzqluCF30FgRAl4xAKCMuZCgpPctFSuYe+VU+YT09bCCQQCeM0FL IUDx+EKv1DpYV+iZ9atbdp0= =r3vl -----END PGP SIGNATURE----- |
|
From: Michael M. <mic...@gm...> - 2007-12-20 07:56:02
|
Hi Jon, most of the basics are the same, so starting with the older
docs shouldn't set you back too much, assuming you're familiar with
Cocoa. I learned the differences by looking through the list archives, and
that wasn't too hard.
As for building it, it's already there. Perhaps the most useful thing
to do is launch XCode, start a few sample projects using the new
project templates, and look through the code and XIBs in there.
The main changes that tripped me up are that to benefit from the IB
integration (I think) you need to use the XIB format, and you want to
declare your class ivars as IBOutlet, and methods as IBAction when
appropriate, like you do in ObjC:
from objc import IBOutlet, IBAction
class SomeWindowController(NSWindowController):
myProgressMeter = IBOutlet()
@IBAction
def haveAHollyJollyChristmas_(self, sender):
# etc...
Then IB will see these just like it does with ObjC IBAction/Outlets,
and you'll hook up your UI like you would for ObjC.
Hope this helps a bit,
-mike
On Dec 19, 2007 2:28 PM, Jon Rosebaugh <ch...@gm...> wrote:
> I'd like to use the latest and greatest version of PyObjC, especially
> since the version provided on the website doesn't seem to even compile
> on Leopard. I see from Ronald Oussoren's message on Dec 7th that the
> documentation for PyObjC2 is not on the site yet. Is there
> documentation anywhere on the net for PyObjC 2? Apple's site doesn't
> seem to have anything for this either.
--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/wp/
|
|
From: Jonathan S. <sa...@gm...> - 2007-12-20 15:16:54
|
The news file is also a great help http://svn.red-bean.com/pyobjc/branches/pyobjc2/pyobjc-core/NEWS.txt The new features are somewhat enumerated there. J On Dec 20, 2007, at 2:56 AM, Michael McCracken wrote: > Hi Jon, most of the basics are the same, so starting with the older > docs shouldn't set you back too much, assuming you're familiar with > Cocoa. I learned the differences by looking through the list > archives, and > that wasn't too hard. > > As for building it, it's already there. Perhaps the most useful thing > to do is launch XCode, start a few sample projects using the new > project templates, and look through the code and XIBs in there. > > The main changes that tripped me up are that to benefit from the IB > integration (I think) you need to use the XIB format, and you want to > declare your class ivars as IBOutlet, and methods as IBAction when > appropriate, like you do in ObjC: > > from objc import IBOutlet, IBAction > > class SomeWindowController(NSWindowController): > myProgressMeter = IBOutlet() > > @IBAction > def haveAHollyJollyChristmas_(self, sender): > # etc... > > Then IB will see these just like it does with ObjC IBAction/Outlets, > and you'll hook up your UI like you would for ObjC. > > Hope this helps a bit, > -mike > > > On Dec 19, 2007 2:28 PM, Jon Rosebaugh <ch...@gm...> wrote: > >> I'd like to use the latest and greatest version of PyObjC, especially >> since the version provided on the website doesn't seem to even >> compile >> on Leopard. I see from Ronald Oussoren's message on Dec 7th that the >> documentation for PyObjC2 is not on the site yet. Is there >> documentation anywhere on the net for PyObjC 2? Apple's site doesn't >> seem to have anything for this either. > > > -- > Michael McCracken > UCSD CSE PhD Candidate > research: http://www.cse.ucsd.edu/~mmccrack/ > misc: http://michael-mccracken.net/wp/ > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services > for just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ |
|
From: Jon R. <ch...@gm...> - 2007-12-20 16:15:38
|
On Dec 20, 2007 1:56 AM, Michael McCracken <mic...@gm...> wrote:
> The main changes that tripped me up are that to benefit from the IB
> integration (I think) you need to use the XIB format, and you want to
> declare your class ivars as IBOutlet, and methods as IBAction when
> appropriate, like you do in ObjC:
>
> from objc import IBOutlet, IBAction
>
> class SomeWindowController(NSWindowController):
> myProgressMeter = IBOutlet()
>
> @IBAction
> def haveAHollyJollyChristmas_(self, sender):
> # etc...
>
> Then IB will see these just like it does with ObjC IBAction/Outlets,
> and you'll hook up your UI like you would for ObjC.
I did figure out where to get IBOutlet and IBAction, but my
ConverterController (I'm following the Currency Converter tutorial)
doesn't seem to be working. When the app starts up, it puts this in
the console:
12/20/07 10:09:29 AM Python Converter Converter[9448] Unknown class
`ConverterController' in nib file, using `NSObject' instead.
12/20/07 10:09:29 AM Python Converter Converter[9448] Could not
connect the action convert: to target of class NSObject
and then obviously clicking the convert button doesn't do anything at all.
Here is my ConverterController class:
class ConverterController(NSObject):
amountField = objc.IBOutlet()
dollarField = objc.IBOutlet()
rateField = objc.IBOutlet()
@objc.IBAction
def convert_(self, sender):
print "Hello World"
self.amountField.setFloatValue_(self.dollarField.floatValue()
* self.rateField.floatValue())
self.rateField.selectText_(self)
|
|
From: Bill B. <bb...@ma...> - 2007-12-20 18:48:22
|
On Dec 20, 2007, at 8:15 AM, Jon Rosebaugh wrote: > I did figure out where to get IBOutlet and IBAction, but my > ConverterController (I'm following the Currency Converter tutorial) > doesn't seem to be working. When the app starts up, it puts this in > the console: > 12/20/07 10:09:29 AM Python Converter Converter[9448] Unknown class > `ConverterController' in nib file, using `NSObject' instead. > 12/20/07 10:09:29 AM Python Converter Converter[9448] Could not > connect the action convert: to target of class NSObject > and then obviously clicking the convert button doesn't do anything > at all. > > Here is my ConverterController class: > > class ConverterController(NSObject): > amountField = objc.IBOutlet() > dollarField = objc.IBOutlet() > rateField = objc.IBOutlet() > > @objc.IBAction > def convert_(self, sender): > print "Hello World" > self.amountField.setFloatValue_(self.dollarField.floatValue() > * self.rateField.floatValue()) > self.rateField.selectText_(self) Make sure you import the file containing the ConverterController class in your main.py. b.bum |
|
From: Ronald O. <ron...@ma...> - 2007-12-23 08:25:01
Attachments:
smime.p7s
|
On 20 Dec, 2007, at 19:48, Bill Bumgarner wrote: > On Dec 20, 2007, at 8:15 AM, Jon Rosebaugh wrote: >> I did figure out where to get IBOutlet and IBAction, but my >> ConverterController (I'm following the Currency Converter tutorial) >> doesn't seem to be working. When the app starts up, it puts this in >> the console: >> 12/20/07 10:09:29 AM Python Converter Converter[9448] Unknown class >> `ConverterController' in nib file, using `NSObject' instead. >> 12/20/07 10:09:29 AM Python Converter Converter[9448] Could not >> connect the action convert: to target of class NSObject >> and then obviously clicking the convert button doesn't do anything >> at all. >> >> Here is my ConverterController class: >> >> class ConverterController(NSObject): >> amountField = objc.IBOutlet() >> dollarField = objc.IBOutlet() >> rateField = objc.IBOutlet() >> >> @objc.IBAction >> def convert_(self, sender): >> print "Hello World" >> self.amountField.setFloatValue_(self.dollarField.floatValue() >> * self.rateField.floatValue()) >> self.rateField.selectText_(self) > > Make sure you import the file containing the ConverterController class > in your main.py. Is that something that can/should be automated? Either by running a macro when Xcode adds a new file (which afaik isn't possible, but you never know), or by having main.py do an os.listdir of the Resources directory and try to import everything that resembles a python module. Ronald > > > b.bum > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |