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 How can I use outfile.write() to wite the contents of the text buffer correctly? Thanks On Feb 18, 1:38 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 17 Feb 2007 20:47:20 -0300, <[EMAIL PROTECTED]> escribió: > > > I'm using Python with pygtk and have this problem - I have read the > > contents of a file into the text buffer with this code, > > > infile = open("mytextfile", "r") > > if infile: > > string = infile.read() > > infile.close() > > textbuffer.set_text(string) > > Note that "if infile" does nothing: either the open succeeds and you get a > file object which is *always* True, or the open fails and raises an > exception and the code below never executes. > > > As a test, I tried to write the buffer back to a file with this code > > but did not work, > > "did not work" means... > > -- > Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list