michal salaban <[EMAIL PROTECTED]> writes:

> i wrote small application using pygtk and glade. everything works fine,
> with one exception: i can't connect a callback to insert_at_cursor
> signal. i have to check TextView contents after every modification.
> delete_from_cursor works fine, paste_clipboard also. insert_at_cursor
> doesn't.

I waited for a while to see if anyone had the answer to this puzzle
before chiming in.  Unfortunately I don't know why the TextView
'insert_at_cursor' signal never seems to be emitted.  Supposedly the
signal is used mostly for key bindings.  If someone understands what's
going on I'd be interested to know.

There is something else you can do that may get you what you need.
Connect to the TextBuffer 'insert-text' signal instead.  The
TextBuffer doesn't explicitly appear as a widget in Glade so you'll
have to connect the signal by hand.  With your example, this will work:

    def on_insert_text(buffer, textiter, text, length):
         print 'inserted %r into buffer' % (text,)

    tv1 = a.get_widget('textview1')
    tv1.get_buffer().connect('insert-text', on_insert_text)
_______________________________________________
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