logo       

Refreshing TextViews: msg#00140

gnome.gtk+.python

Subject: Refreshing TextViews

How can I force a TextView to refresh itself after applying tags to a
TextBuffer? I have some test code that causes everything the user inserts to
be made green, but it doesn't display correctly.


def bufferInsert(widget, event, *args):
widget.stop_emission("insert-text")
widget.handler_block(sig_insert)
widget.insert_with_tags(widget.get_iter_at_mark(widget.get_insert()),
args[0],
green)
widget.handler_unblock(sig_insert)
view.queue_draw() #these two lines seem like they should work,
gtk.mainiteration() #but don't appear to do anything

sig_insert = buffer.connect("insert-text", bufferInsert)


A typed character will appear immediately, but it will not turn green until
the next update/event -- for example, typing another character, clicking the
mouse, or even a blink of the text cursor. I'd like it to be green
immediately :) Any way to do this?

Thanks,

Jason

P.S. I'm working toward syntax highlighting. No, I'm not actually planning to
separately tag every character, but it was an easy test case.

_______________________________________________
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>
Google Custom Search

News | FAQ | advertise