Hello world.

I'm trying to insert characters in a textview, in a position different from the one 
where's the cursor.

I'm alwais getting this warning:
Gtk-WARNING **: Invalid text buffer iterator: either the iterator is uninitialized, or 
the characters/pixbufs/widgets in the buffer have been modified since the iterator was 
created.[...]

This a simple example code, of a method called on insert_text event .
When 6 characters are typed,it tries to put an 'X' in the second cursor position, and 
then to put the cursor where it was before.


def on_insert_text(self,buffer,textIter,char,*args):
    buffer.disconnect(self.signal_id)
    if textIter.get_chars_in_line()==6 :
        newIter=buffer.get_iter_at_offset(2)
        buffer.insert(newIter,'X')
        buffer.place_cursor(buffer.get_end_iter())
    self.signal_id=buffer.connect('insert-text',self.on_insert_text)

I understand from the warning that I should use marks, but I don't know how.

Thanks for help,
Riccardo

-- 
-=Riccardo Galli=-

 _,e.
s~  ``
 [EMAIL PROTECTED]   ideralis Programs
.   ol 
 `**~  http://www.sideralis.net
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to