import gtk

w = gtk.Window()
tv = gtk.TextView()
w.add(tv)
tb = tv.get_buffer()
tag = tb.create_tag('invisible')
tag.props.invisible = True

tb.insert(tb.get_start_iter(), "Not hidden\n")

w.show_all()

it = tb.get_start_iter()
tb.insert(it, "Not hidden\n")
for i in xrange(10000):
    tb.insert(it, "%d\n" % i)
    tb.apply_tag(tag, tb.get_iter_at_offset(11), it)
    gtk.main_iteration(False)
