Re: [Pyobjc-dev] Displaying HTML in NSTextView
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-07-03 16:53:48
|
On Thursday, Jul 3, 2003, at 17:40 Europe/Amsterdam, Dinu Gherman wrote: > I wondered: > >> did anybody succeed already in displaying HTML code properly >> inside NSTextViews? If so, I'd be grateful for a simple code >> snippet... The ObjC stuff I've found so far does successfully >> resist my Pythonification attempts... > > Strange... There seems to be a method for NSAttributedString with > the following ObjC-signature: > > - (id)initWithHTML:(NSData *)data > baseURL:(NSURL *)aURL > documentAttributes:(NSDictionary **)docAttributes $ python Python 2.3b2+ (#1, Jun 30 2003, 17:14:46) [GCC 3.1 20020420 (prerelease)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import AppKit >>> import Foundation >>> Foundation.NSAttributedString.initWithHTML_baseURL_documentAttributes_ <unbound native-selector initWithHTML:baseURL:documentAttributes: in NSAttributedString> >>> The signature is: (NSData, NSURL) -> (self, attributes), the documentAttributes is an output argument. You must import AppKit before using this method, the method is in a categorie. Ronald |