From f0b8309c0af155e63ea7ea2b19947192aa6ca9a3 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 28 May 2011 10:40:01 +0200 Subject: [PATCH] label: prevent creation of initial label until text is set. Closes #160 --- kivy/uix/label.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kivy/uix/label.py b/kivy/uix/label.py index 841bc1120..533c732c6 100644 --- a/kivy/uix/label.py +++ b/kivy/uix/label.py @@ -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