Getting Cursor position in Tkinter entry widget

dhruvvyas90

I've an entry widget in my tkinter program. Let's say I typed about 10 words in it and went to another entry widget for typing. Now when I click back on my entry widget 1 (previous one), cursor goes to the character as per click position. How do I get cursor position index for that widget ? I referred to http://effbot.org/tkinterbook/entry.htm documentation but couldn't find a suitable method for getting cursor position.

Thanks.

tobias_k

You can use the index method to get the index of the current INSERT position.

from Tkinter import *

def get_info():
    print e.index(INSERT)

root = Tk()
e = Entry(root)
e.pack()
Button(root, text="get info", command=get_info).pack()
root.mainloop()

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

The Tkinter Entry Widget Insertion Cursor

How to change cursor position in Python tkinter Entry widget at every inserted and deleted values

Block Insertion Cursor Style in Tkinter Entry Widget

Tkinter - Getting input without the Entry Widget?

Remove a character on the left of the cursor in Tkinter entry widget in python 3

Set default caret position inside entry widget in Tkinter Python

Entry widget Tkinter. I am getting confused

Tkinter entry widget execution

validation of tkinter entry widget

Tkinter Entry widget insertwidth

hint entry widget tkinter

Getting the cursor position of a GtkEntry

Issue in Entry Widget resizing in tkinter

How to delete the current entry in tkinter Entry widget

set Tkinter label widget below entry widget

Getting cursor position in mailItem htmlbody

Tkinter - getting an array of entry values

change cursor location in click event on tkinter entry

PySimpleGUI: Set and get the cursor position in a multiline widget?

Printing input to textbox from entry widget with tkinter

Adding placeholders to tkinter Entry widget in a procedural way

tkinter Entry widget detect if there is any selection

Errors when trying to clear Tkinter Entry Widget

Tkinter event binding of entry widget for password verification

How to set default text for a Tkinter Entry widget

How to set default text for a Tkinter Entry widget

tkinter entry widget textvariable will not update with .set method

Event callback after a Tkinter Entry widget

Write Input from Entry Widget into CSV (tkinter)