Search code examples
gtkgtk3

Set cursor at end of Gtk.Entry


In gtk3, I'm setting the text of an Entry, but the cursor remains at the front (position 0) of the Entry, and I'd like to move the cursor to the end. Is there a way for me to do that?

my_entry.buffer.set_text my_text, my_text.length
# ...now the cursor is at the start of the entry

Solution

  • A GtkEntry implements GtkEditable. So you can use gtk_editable_set_position(editable, -1)