How to Get the Value of a gtk.TextView in Python
There doesn't seem to be many good, easy explanations on the Internet about how to get the value of a gtk.TextView widget. So, here are the two little lines of code for this simple task.
This code makes easy work of reading the buffer, using the get_buffer() method, of your gtk.TextView object and converting that to a string, using the get_text() method on the buffer, for output, etc.
For reference, here are a couple of error messages I ran across on my quest to get the value out of a GTK text view:
- TypeError: start should be a GtkTextIter
- AttributeError: 'gtk.TextView' object has no attribute 'get_text'