[Pythonmac-SIG] Example of stand-alone NSRunLoop?
Ronald Oussoren
ronaldoussoren at mac.com
Wed Oct 15 11:58:44 CEST 2008
On Wednesday, October 15, 2008, at 11:25AM, "Jack Jansen" <Jack.Jansen at cwi.nl> wrote:
>
>On 15 okt 2008, at 05:34, Joe Strout wrote:
>> # Now we need a NSRunLoop...
>> runLoop = NSRunLoop.alloc() # note: no init() method?
This is definitely wrong, you must always call some kind of init method after calling alloc.
>> 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()
Or better yet:
runLoop = NSRunLoop.currentRunLoop().
The difference is that mainRunLoop returns the run loop for the main thread,
currentRunLoop returns the run loop for the current thread.
Ronald
More information about the Pythonmac-SIG
mailing list