index in Tkinter text objects
the_mantis at antionline.com
Sun Sep 3 20:58:55 CEST 2000
thanks for the info. it worked fine, but is there a way to get the first and
the last index of a string of highlighted (for cut and copy purposes) text?
thanks once again.
from Keagan Schopfer
Fredrik Lundh <effbot at telia.com> wrote in message
news:cN4s5.5265$HK.247471 at newsc.telia.net...
> Keagan Schopfer wrote::
> > i am building a text editor using Tkinter, and i am wondering how i
> > find the current index of the insert currsor in a Text dialog. is there
> > function like text.get_current_index()?
> the insert cursor has a symbolic name (INSERT), which
> you can use everywhere Tkinter expects a buffer index.
> to get the current line/column, use text.index(INSERT)
> (this returns a string). an example:
> # get line/column
> index = text.index(INSERT)
> # convert index to integers
> row, column = map(int, string.split(index, "."))
> also see:
> <!-- (the eff-bot guide to) the standard python library:
More information about the Python-list