Python Gtk TextView inserts text at end

I want to insert text in a textbuffer at the end ... Im using this: gtk.TextBuffer.insert_at_cursor

But if I click on the text, a new cursor appears there ...

How to add text at the end?

+6
source share
1 answer

Try using gtk.TextBuffer.insert() with gtk.TextBuffer.get_end_iter() , Example:

 # text_buffer is a gtk.TextBuffer end_iter = text_buffer.get_end_iter() text_buffer.insert(end_iter, "The text to insert at the end") 

NOTE. After you paste into text_buffer end_iter is invalid, make sure you get a new link to the final iterator when you want to add to the end of the buffer.

+7
source

All Articles