Re: [Pyobjc-dev] working code examples ?
Brought to you by:
ronaldoussoren
From: Bill B. <bb...@co...> - 2000-12-20 22:57:26
|
Do you have the code you are testing with so far? You need to star the Application's event loop before you can really do anything like handling button presses. After creating your button, call the -setTarget: and -setAction: methods appropriately to set up the target/action for when the button is pressed. Alternatively, loading a main NIB file as created by InterfaceBuilder would set up all the target/action stuff correclty for a main menu, etc... just make your python object the delegate of the Application object to allow your custom python code to handle the various events passing down the responder chain. b.bum From: "Steven D. Majewski" <sd...@mi...> Date: 2000-12-20 17:38:08 -0500 To: pyo...@li... Subject: [Pyobjc-dev] working code examples ? List-Id: python<->ObjC module dev discussion <pyobjc-dev.lists.sourceforge.net> MMDF-Warning: Parse error in original version of preceding line at mail.virginia.edu List-Post: <mailto:pyo...@li...> X-BeenThere: pyo...@li... List-Unsubscribe: <http://lists.sourceforge.net/mailman/listinfo/pyobjc-dev>,<mailto:pyo...@li...?subject=unsubscribe> List-Help: <mailto:pyo...@li...?subject=help> X-Mailman-Version: 2.0 List-Archive: <http://lists.sourceforge.net/archives//pyobjc-dev/> List-Subscribe: <http://lists.sourceforge.net/mailman/listinfo/pyobjc-dev>,<mailto:pyo...@li...?subject=subscribe> BTW: Does anyone have any examples of code that actually works under Mac OSX ? I can get a window with a button to pop up (starting from some example code from one of the older snapshots on codefab.com -- LBW.py -- "little button window" ) but none of the "application" stuff works -- i.e. I can't get it to quit from the button. BTW: a few notes for those trying to get started: import ObjC rt = ObjC.runtime # You need to create an autorelease pool to avoid all of those annoying # 'no pool -- just leaking' warning messages: POOL = rt.NSAutoreleasePool p = POOL() # and if you want to access AppKit classes from the runtime, # you have to load that bundle: rt.NSBundle.bundleWithPath_('/System/Library/Frameworks/AppKit.framework').load() ... and if you're testing out some code and actually want to see what happens to your window while you're in the python interpreter in a terminal.app window, you can make your AppKit window a floating window with setLevel: win.setLevel_ (3) -- Steve Majewski <sd...@Vi...> _______________________________________________ Pyobjc-dev mailing list Pyo...@li... http://lists.sourceforge.net/mailman/listinfo/pyobjc-dev |