How do I save the contents of a text buffer

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sun Feb 18 01:34:21 EST 2007


On Sat, 17 Feb 2007 17:10:50 -0800, google wrote:

> I just included file opening code just to show how i read the file
> into the text buffer - I have no issues with this as such. Problem is
> only with the writing of the text buffer back to a file. When I try to
> write the buffer to a file it gave the following,
> 
> <gtk.TextBuffer object (GtkTextBuffer) at 0xb7cff284>
> Traceback (most recent call last):
>   File "./configbox.py", line 78, in ?
>     TextViewExample()
>   File "./configbox.py", line 53, in __init__
>     outfile.write(textbuffer.get_text(0,1000,
> include_hidden_chars=True))
> TypeError: start should be a GtkTextIter


Ah, well there's your problem. start should be a GtkTextIter, just like
the exception says.

Question for you: in the line of code in the traceback, which function
takes an argument called "start"?


> How can I use outfile.write() to wite the contents of the text buffer
> correctly?

Your problem isn't with outfile.write(). 



-- 
Steven.




More information about the Python-list mailing list