Tkinter, icursor() method on a Text widget

Peter Otten __peter__ at web.de
Sun Nov 9 12:15:38 CET 2003


snx7s wrote:

> Hi,
> 
> using Tkinter, on a Text widget i would like to place the cursor to a
> given position like the icursor() method of the Entry widget.
> Is it possible do that, if it is how please ?
> 
> Thank You.

Use text.mark_set(Tkinter.INSERT, "5.2") to move the cursor to column 2 in
row 5, where columns start at 0 and the first line is 1.
There are other more complicated forms, like text.mark_set(Tkinter.INSERT,
"1.0 +100 chars") which goes to the hundreth char (counting newlines).

For details and the general concept behind this, see
http://www.nmt.edu/tcc/help/pubs/tkinter.pdf


Peter





More information about the Python-list mailing list