4
插入文本我想在末尾插入文本到textbuffer ... 进出口使用此:gtk.TextBuffer.insert_at_cursor
Python的基于GTK的TextView在结束
但如果我点击到文本有光标处新出现..
如何在最后添加文本?
插入文本我想在末尾插入文本到textbuffer ... 进出口使用此:gtk.TextBuffer.insert_at_cursor
Python的基于GTK的TextView在结束
但如果我点击到文本有光标处新出现..
如何在最后添加文本?
尝试使用gtk.TextBuffer.insert()
与gtk.TextBuffer.get_end_iter()
。例如:
# 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")
注意:一旦你插入text_buffer
,end_iter
将失效,从而确保无论何时你要追加到缓冲区的末尾,以获得新的参考,以最终迭代器。