- fixes issue #649, simpler alternative to pull request # 651

This commit is contained in:
Edwin Marshall (aspidites) 2012-08-28 01:31:23 -04:00
parent c3a0f48828
commit dc70c6d359
1 changed files with 8 additions and 11 deletions

View File

@ -396,19 +396,16 @@ class LabelBase(object):
sz[1] + self.options['padding_y'] * 2
def _get_text(self):
return self._text
try:
return self._text.decode('utf8')
except AttributeError:
# python 3 support
return str(self._text)
def _set_text(self, text):
if text == self._text:
return
# try to automaticly decode unicode
try:
self._text = text.decode('utf8')
except:
try:
self._text = str(text)
except:
self._text = text
if text != self._text:
self._text = text
text = property(_get_text, _set_text, doc='Get/Set the text')
label = property(_get_text, _set_text, doc='Get/Set the text')