label: prevent creation of initial label until text is set. Closes #160

This commit is contained in:
Mathieu Virbel 2011-05-28 10:40:01 +02:00
parent 1e3f928dd8
commit f0b8309c0a
1 changed files with 6 additions and 3 deletions

View File

@ -74,10 +74,13 @@ class Label(Widget):
After this function call, the :data:`texture` and :data`texture_size`
will be updated in this order.
'''
self._label.refresh()
self.texture = None
self.texture = self._label.texture
self.texture_size = list(self.texture.size)
if self._label.text.strip() == '':
self.texture_size = (0, 0)
else:
self._label.refresh()
self.texture = self._label.texture
self.texture_size = list(self.texture.size)
#
# Properties