def set_text(self,markup): """ Set content of text widget. markup -- see __init__() for description. >>> t = Text("foo") >>> t.text 'foo' >>> t.set_text("bar") >>> t.text 'bar' >>> t.text = "baz" # not supported because text stores text but set_text() takes markup Traceback (most recent call last): ... AttributeError: can't set attribute """ self._text, self._attrib = decompose_tagmarkup(markup) self._invalidate()
def set_caption(self, caption): """ Set the caption markup for this widget. caption -- see Text.__init__() for description of markup >>> e = Edit("") >>> e.set_caption("cap1") >>> e.caption 'cap1' >>> e.set_caption(('bold', "cap2")) >>> e.caption 'cap2' >>> e.attrib [('bold', 4)] >>> e.caption = "cap3" # not supported because caption stores text but set_caption() takes markup Traceback (most recent call last): ... AttributeError: can't set attribute """ self._caption, self._attrib = decompose_tagmarkup(caption) self._invalidate()
def set_text(self, markup): self.text, self.attrib = decompose_tagmarkup(markup) self._invalidate()