On Mon, 7 May 2001 [EMAIL PROTECTED] wrote:

> How do you extract the text from a GtkTextBuffer using the PyGtk interface?
> I tried the following:
>
>     buf.get_text(0, -1, gtk.TRUE)
>
> but was told that arg 1 needed to be a GtkTextIter object (presumably the
> same would hold for arg 2).  Alas, there appears to be no GtkTextIter class
> exposed in the PyGtk interface.  I only see a GtkTextIterType object.

There are functions to get iters for a particular GtkTextBuffer (they
don't have quite the same signature as in C):
  iter = buffer.get_iter_at_line_offset(line_number, char_offset)
  iter = buffer.get_iter_at_line_index(line_number, byte_index)
  iter = buffer.get_iter_at_offset(char_offset)
  iter = buffer.get_iter_at_line(line_number)
  iter = buffer.get_end_iter()
  start, end = buffer.get_bounds()
  iter = buffer.get_iter_at_mark(mark)

GtkTextIters also have all the methods found in gtktextiter.h, so you can
also do things like copy an existing iter and move it.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to