OK, this one is an easy and quick stuff, that I’m almost ashame to share. But the thing is, I search for it, and I wasn’t even sure where to look at it. The reason I put it here is because I trying to put together some trick about urwid, stuff I spend some time to looking for, even if it isn’t so much time. If someone need it, he should find it easily here.
The idea is to highlight some worlds in a string. The answer was right in the
front of me from the start! As it was shown in the
tour.py, the very first
script in the official tutorial.
txt = urwid.AttrWrap(urwid.Text([ "Some random text, with an ", ('hl', "IMPORTANT "), "word. Other boring stuff." ]), 'main')
This short example, witch is only a part of a code of course, shows a string
main color, with the IMPORTANT word colored with the
attribute. It only a list, with a tuple for different colors, color attribute
As I said, it isn’t a very exalting post, just a quick trick.