git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gtk.TextBuffer problem on converting from GTK+ 2 to GTK+ 3


MRAB <python at mrabarnett.plus.com> wrote:
> > 
> > What am I doing wrong?  Virtually nothing has changed in this part of
> > my code between gtk+ 2 and gtk+ 3, just the import and gtk to Gtk and
> > a couple of enum formats.
> > 
> You're creating a TextBuffer and a TextView, but I don't see any code 
> that ties them together. How would the view know to display the contents 
> of the buffer?

Absolutely right, thank you. I should have spotted that.  I think the
Gtk.TextView contructor used to take a buffer parameter but the
version 3 one doesn't so I had removed it. Hence, as you say, no code
tying them together.  I've simply changed to:-

    self.view = Gtk.TextView.new_with_buffer(self.buffer)

... and all is well again.


-- 
Chris Green
?