diff pyntnclick/widgets/text.py @ 813:3a875256f795 pyntnclick

better visible handling
author Neil Muller <neil@dip.sun.ac.za>
date Sun, 27 Jan 2013 17:33:04 +0200
parents bcc9277a23e6
children 9f542ef6e498
line wrap: on
line diff
--- a/pyntnclick/widgets/text.py	Sun Jan 27 16:50:04 2013 +0200
+++ b/pyntnclick/widgets/text.py	Sun Jan 27 17:33:04 2013 +0200
@@ -15,7 +15,6 @@
         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)
@@ -59,8 +58,9 @@
         self.surface = new_surface
 
     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 TextButton(Button, TextWidget):