[pygtk] Highlighting a line in a TextView

Patrick Sabin patrick.just4fun at gmail.com
Mon May 10 22:37:57 WST 2010


Hi,

I have a TextView and a corresponding TextBuffer and I want to highlight 
a line of text (by changing its background color). I have tried to use 
tags:

iter1 = self.textbuffer.get_iter_at_line(3)
iter2 = self.textbuffer.get_iter_at_line(4)
self.textbuffer.create_tag("highlighted",  background = "red")
self.textbuffer.apply_tag_by_name("highlighted", iter1, iter2)

This only highlights the characters in the line, but not everything 
until the end of the line.

Any ideas to get this work to highlight everything to the end of line?

- Patrick


More information about the pygtk mailing list