Tomás Touceda wrote on 2010-06-06 15:11: > Hi, > > what's the best approach to handle text decorations of the type: syntax > highlighting, selected text?
I would make a custom widget, either a subclass of Text (if you want the interface to be very similar to a Text widget) or a subclass of WidgetWrap that uses a Text widget as self._w (if you want more control over the interface). If you're making a subclass of Text you can simply override the get_text() method and return the attributes you want along with the text (see http://excess.org/urwid/reference.html#Text-get_text ) With a WidgetWrap subclass you can set the Text's attributes when setting the text, eg.: # use attributes based on syntax self._w.set_text([('keyword', "class"), " Foo", ('punct', ":")]) HTH, Ian _______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
