diff pyntnclick/widgets/text.py @ 792:bdaffaa8b6bf pyntnclick

Loading and saving! (Plus a bunch of other stuff to make it possible.)
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 27 Jan 2013 12:43:28 +0200
parents efa58c92b304
children bcc9277a23e6
line wrap: on
line diff
--- a/pyntnclick/widgets/text.py	Sat Jan 26 20:29:58 2013 +0200
+++ b/pyntnclick/widgets/text.py	Sun Jan 27 12:43:28 2013 +0200
@@ -15,6 +15,7 @@
         self.fontname = fontname or constants.font
         self.fontsize = fontsize or constants.font_size
         self.color = color or constants.text_color
+        self.visible = True
 
     def prepare(self):
         self.font = self.resource.get_font(self.fontname, self.fontsize)
@@ -26,8 +27,9 @@
         self.rect.height = max(self.rect.height, height)
 
     def draw(self, surface):
-        self.do_prepare()
-        surface.blit(self.surface, self.rect)
+        if self.visible:
+            self.do_prepare()
+            surface.blit(self.surface, self.rect)
 
 
 class LabelWidget(TextWidget):