[Pythonmac-SIG] Example of stand-alone NSRunLoop?
Jack Jansen
Jack.Jansen at cwi.nl
Wed Oct 15 11:25:58 CEST 2008
On 15 okt 2008, at 05:34, Joe Strout wrote:
> # Now we need a NSRunLoop...
> runLoop = NSRunLoop.alloc() # note: no init() method?
> runLoop.run()
I think allocating a runloop is hardly ever what you need: there's one
already, and you want to get that:
runLoop = NSRunLoop.mainRunLoop()
This indeed brings up the speech listener window-let (Can't test it,
no microphone right now).
This is a paradigm you'll come across often in Cocoa: there's a lot of
objects of which there is one instance per application, and there's a
class method to get that instance. NSApplication, NSFontManager,
NSNotificationCentre, too many to mention, really.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma
Goldman
More information about the Pythonmac-SIG
mailing list