Re: [Pyobjc-dev] import framework for newbie
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-01-05 17:18:31
|
On Jan 5, 2004, at 12:01 PM, Wezzy wrote: > Hi all, after reading docs about wrapping new framework i've made some > test with my own framework, but i'm not able to import it. So i've > tried with webkit framework (just for testing) but it doesn't work. > > This is my code: > > WebKit.py: > import objc > pyobjc.loadBundle("WebKit",globals(),bundle_path="/System/Library/ > Frameworks/WebKit.framework") > del objc Do you mean: import objc objc.loadBundle("WebKit",globals(),bundle_path="/System/Library/ Frameworks/WebKit.framework") del objc > inside the interpreter: > import WebKit > wb = WebKit.WebView() You probably want: import WebKit wb = WebKit.WebView.alloc().init() because: wb = WebKit.WebView() is going to raise "TypeError: Use class methods to instantiate new Objective-C objects" > now i have an error, WebKit doesn't have WebView attributes. You shouldn't be getting that particular error. What version of PyObjC and OS X are you using? I'm using a month old CVS version of PyObjC (Dec 03 2003) on OS X 10.3.2 (7D24). Are you sure that you have WebKit installed? Is there *anything* in the imported WebKit module -- dir(WebKit)? -bob |