From: Ronald Oussoren <ronaldoussoren@ma...> - 2005-03-08 10:57:45
On Tuesday, March 08, 2005, at 10:52AM, Clive Jevons <clive@...> wrote:
>I've got a string with HTML in it and want to show that - as rendered
>HTML - in an NSTextView. I've trawled the web for a while, and it seems
>the only way to do that is to fill an NSAttributedString (or subclass)
>with the HTML using a method like initWithHTML_documentAttributes_ and
>then setting that attributed string on the textStorage of the
You could try to use WebView (osx 10.2.8 or later) to get a proper webbrowser view.
>Almost all is well.
>I just get a weird [OS_PythonArray string] selector not recognized ???
>Its obvious what the messag is trying to tell me - that the class
>OS_PythonArray doesn't have a method string .... but why is it trying
>to call this?
>Here's my code, I hope someone can help me out here :)
> def observeValueForKeyPath_ofObject_change_context_ (self, path,
> object, change, context):
> if path == 'selectionIndex':
> selection = self.entriesController.selectionIndex()
> log.info("Selection changed to " \
> + str(selection))
> the_str = self.delegate.entries[selection]['description']
> data =
> new_str = NSMutableAttributedString.alloc(). \
The return-value of initWithHTML_documentAttributes_ is (new_str, doc_attr).
In ObjC this method has a second argument that is a pointer to a second return value. Because python doesn't support pass-by-reference arguments output arguments are converted to additional return values by PyObjC.