|
textview: how to insert characters?: msg#00005gnome.gtk+.python
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~ `` ~@. ideralis Programs . ol `**~ http://www.sideralis.net _______________________________________________ pygtk mailing list pygtk@xxxxxxxxxx http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Conflicting omniORBpy and PyORBit: 00005, James Henstridge |
|---|---|
| Next by Date: | GObject properties: 00005, Jan Weil |
| Previous by Thread: | Conflicting omniORBpy and PyORBiti: 00005, ml |
| Next by Thread: | Re: textview: how to insert characters?: 00005, Tom Cato Amundsen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |