index in Tkinter text objects

Keagan Schopfer 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
would
> > find the current index of the insert currsor in a Text dialog. is there
some
> > 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:
> http://w1.132.telia.com/~u13208596/tkintrobook/text.htm
>
> </F>
>
> <!-- (the eff-bot guide to) the standard python library:
> http://www.pythonware.com/people/fredrik/librarybook.htm
> -->
>





More information about the Python-list mailing list