Hi,
I am a newbie and I need some help with TextView.
I would like to be able to dynamically (on insert) highlight or change
the color of words in a TextView when those belong to a keyword list I
have.
I have found some functions on the Internet (like the one below) but
can't seem to make them work :(
def highlightText(self, gtk.TextBuffer, searchStr):
buffer.create_tag("red_foreground", foreground="red")
start, end = buffer.get_bounds()
finished = False
while finished == False:
res = start.forward_search(searchStr,
gtk.TEXT_SEARCH_TEXT_ONLY)
if not res:
finished = True
else:
matchStart, matchEnd = res
buffer.apply_tag_by_name("red_foreground",
matchStart, matchEnd)
start = matchEnd
Any help is appreciated
Thanks
--
Nolwenn
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/