Re: [Pyobjc-dev] Pure Python Cocoa GUI application?
Brought to you by:
ronaldoussoren
|
From: Orestis M. <or...@or...> - 2009-03-16 14:45:29
|
On 15 Mar 2009, at 22:54, Greg Ewing wrote:
> Orestis Markou wrote:
>
>> I've tried to do:
>> app = NSApplication.sharedApplication()
>> app.setDelegate_(delegate)
>> app.run()
>> but things crash soon after.
>
> That's strange, because I do something very similar in
> PyGUI and it seems to work.
>
> I've only tested it on 10.4, though. It's possible that
> things are different in 10.5.
>
> Have you tried running it with pythonw instead of
> python?
Hm, weird. I did (complete file):
from Foundation import *
from AppKit import *
class Delegate(NSObject):
def applicationDidFinishLaunching_(self, sender):
NSLog('DID FINISH LAUNCHING')
NSLog('launching')
app = NSApplication.sharedApplication()
delegate = Delegate.alloc().init()
app.setDelegate_(delegate)
app.run()
and it seemed to work. I think I may have alloc'ed the delegate and
not bound it to a name, so it got GC'ed and then things crashed.
Thanks! Now, to get a window up...
Orestis
|