[pygtk] Beginning of buffer in a TextView

Mírian Bruckschen cleo.sl at gmail.com
Tue Aug 28 19:02:31 WST 2007


Hi all,

I've been trying to do something that, I guess, is pretty easy, which
is to place the cursor in the beginning of a textview's buffer.

Here's the code snippet where I'm trying to do it (and if it's not the
best way of  doing that, somebody please let me know; I'm pretty new
to both python and pygtk):

        textview1 = mainWindow.get_widget("textview1")
        (...)
        textview1.set_editable(False)
        buffer1.set_text("my text here (...)")
        textview1.set_wrap_mode(gtk.WRAP_WORD)
        textview1.move_visually(
textview1.get_buffer().get_end_iter(),
textview1.get_buffer().get_char_count() * -1)

Does anybody know what I'm doing wrong? If I print the last command's
result, it prints "True", so it means my cursor should be placed where
I'm telling it to be, no? (And, of course, if there is a simpler way
to do that, I'd love to know also.)

Thanks for any help,

-- 
Mírian Bruckschen


More information about the pygtk mailing list