I have gtk.Textview . I want to find and select a piece of text in this TextView programmatically. I have this code, but it does not work correctly.
search_str = self.text_to_find.get_text() start_iter = textbuffer.get_start_iter() match_start = textbuffer.get_start_iter() match_end = textbuffer.get_end_iter() found = start_iter.forward_search(search_str,0, None) if found: textbuffer.select_range(match_start,match_end)
If the text is found, then it selects all the text in the TextView , but I need to select it only the found text.
source share