Tkinter - How to insert text at the beginning of the text box?

python, textbox, tkinter

Solution

text_widget.insert('1.0', 'my status here.\n')

In short, the text widget can be indexed using a string notation of the form `"lineNum.columnNum"`, as well as using the special indices like `Tkinter.INSERT`.

I would recommend reading effbot's documentation for the Tkinter text widget, or New Mexico Tech's Tkinter Handbook, which I've found has fewer examples and explanations, but is more complete as an API reference.

Problem

I am using Python 2.7.5 and Tkinter. I am writing status messages into a text widget. To insert I am using: ``` text_widget.insert(INSERT, 'my status here.\n') ``` This works fine. However, each status is added after the previous status. How do I insert new lines at the top of the `Text` widget so that the most recent status is at the top, while keeping the previous status messages below? Thanks.

Original source