Fredrik Lundh
2003-01-05 15:39:59 UTC
After loading the contens of a text file into a text widget with something
like: <snip>
content = inf.read()
self.textbox.insert(END, content)
self.textbox.focus_set()
</snip>
I want the insert cursor to be at the home position after the file has
loaded.Is there a simple method to position the cursor at a given index? I
haven't *found* any in the "prevailing" Tkinter sources across the web
yet...
the cursor is represented by a predefined mark called INSERT. tolike: <snip>
content = inf.read()
self.textbox.insert(END, content)
self.textbox.focus_set()
</snip>
I want the insert cursor to be at the home position after the file has
loaded.Is there a simple method to position the cursor at a given index? I
haven't *found* any in the "prevailing" Tkinter sources across the web
yet...
move it around, use the mark_set method:
self.textbox.mark_set(INSERT, 1.0)
more information here:
http://www.pythonware.com/library/tkinter/introduction/text.htm
(click on "Concepts" and scroll down to "Marks")
</F>