Gtk.TextView does not scroll


in my application I have several TextViews aligned in a grid horizontally. They all scroll syncronous (to my surprise) this works automatically.
Now i want at a certain keyboard shortcut, to jump the cursor to a line number and select the line. This also works. What does not work is to scroll to this line. My code looks like this:

            # to sequence view to class

            # focus
            tab = nb.get_tab(class_name)
            tv = tab.sequenceTextView

            # set postion in textfield
            buf = tab.sequenceBuf
            cursor = buf.get_iter_at_line(position)
            res = tv.scroll_to_iter(cursor, 0.0, True, 0.5, 0.5)

            # select line
            line_begin = buf.get_iter_at_line(position) # again, since forward_to_line does not return a copy
            buf.select_range(line_begin, cursor)

            # scroll

Except to the last line everything works fine.
I tried virtually anything: scroll to an iter, scroll the first textview added to the grid, scroll to cursor.
Also I get no warning which helps. With the (test) line

            res = tv.scroll_to_iter(cursor, 0.0, True, 0.5, 0.5)

above, I got as return code False, which is indeed correct. But I still can’t figure out, why.

Thanks in advance!


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.