Somesh Bartakke wrote:

am using TextView widget in a program.
i want to get Iter at current cursor position,
how to get it ?
i couldnt find the function for that .
I have no idea if this is the best way to do it. But this is what I am
doing and it works fine for me. This code is from a project that defines
a TextView called file_textview using glade. But the signal handler is
attached in the code rather than in glade.

    def init_text_display(self):
        self.text_view = self.widgets.get_widget('file_textview')
        self.text_buffer = self.text_view.get_buffer()
        self.text_buffer.connect('mark-set', self.on_insertion_moved)

    def on_insertion_moved(self, text_buffer, iter, text_mark):
        # see if the cursor has really moved
        offset = iter.get_offset()
        if self.last_offset != offset:
            self.last_offset = offset
            # processing here

Greg
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to