How to move insert to position in Text widget (Tkinter)

Fredrik Lundh fredrik at pythonware.com
Fri Mar 25 07:38:28 EST 2005


Harlin Seritt wrote:

>I am working on a Find Text dialog box. Once you find a string in a
> Text widget, how do you at least move the cursor to that index
> (position)?

    widget.mark_set(INSERT, pos)

> Even better how can one 'select' the string one finds?

    widget.tag_add(SEL, pos, endpos)

to remove an existing selection, use

    widget.tag_remove(SEL, 1.0, END)

</F> 






More information about the Python-list mailing list