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
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 " \
the_str = self.delegate.entries[selection]['description']
new_str = NSMutableAttributedString.alloc(). \
The content of the_str is valid HTML, which works fine in other tools -
and I've also tried it with hardcoding
the_str = '<html><body><h1>Hello</h1></body></html>'
... this didn't work either - same result.
BTW - if someone knows a better or easier way to just display HTML
which is in a String as rendered HTML in Cocoa, please, please tell me
PS: If this appears twice, I'm sorry - I sent it from the wrong email
address the first time - D'OH!
From: Russell Finn <rsfinn@gm...> - 2005-03-10 22:33:59
On Tue, 8 Mar 2005 10:51:26 +0100, Clive Jevons <clive@...> wrote:
> I've got a string with HTML in it and want to show that - as rendered
> HTML - in an NSTextView.
Does it *have* to be in an NSTextView? It seems like you'd rather use
a WebView instead.
> BTW - if someone knows a better or easier way to just display HTML
> which is in a String as rendered HTML in Cocoa, please, please tell me
I've got some working code that uses a WebView right here... oh, wait,
my PowerBook's at the repair depot. Darn. Ping me about it next week
and I'll send it to you. It's easy.
-- Russell Finn
Get latest updates about Open Source Projects, Conferences and News.