Is it possible to set the cursor position in a Tkinter Text widget? I'm not finding anything terribly useful yet.
The best I've been able to do is emit a <Button-1>
and <ButtonRelease-1>
event at a certain x-y coordinate, but that is a pixel amount, not a letter amount.
If "text", "line", and "column" are your text object, the desired text line and desired column variables are, respectively:
text.mark_set("insert", "%d.%d" % (line + 1, column + 1))
If you would not like to care about the line number... well, you have to.
Complete documentation at The Tkinter Text Widget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With