Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to bind a TextView to the key "text" by TextBuffer. I get the text, but this property is not recorded.

widget = self.builder.get_object('textbuffer_text')
settings.bind("text", widget, "text", Gio.SettingsBindFlags.DEFAULT)

I would be grateful for any hints or help

share|improve this question

I set it manually, but it is annoying.

widget = self.builder.get_object('textbuffer_text')
#~ self.settings.bind("text", widget, "text", Gio.SettingsBindFlags.DEFAULT)
text = self.settings.get_string("text")
widget.set_text(text, len(text))

...

def on_textbuffer_text_changed (self, widget):
    b,e = widget.get_bounds()
    self.settings.set_string("text", widget.get_text(b,e,False).decode('utf-8'))
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.