Explain Widget methods
authorStefano Rivera <stefano@rivera.za.net>
Sun, 11 May 2014 19:04:15 +0000 (21:04 +0200)
committerStefano Rivera <stefano@rivera.za.net>
Sun, 11 May 2014 19:04:15 +0000 (21:04 +0200)
naja/widgets/base.py

index 6b86a870f5adadbb518ed4fc4caae837ccce7650..bda00a4b755a4c91b8738096a003b6e40f65aac9 100644 (file)
@@ -12,18 +12,21 @@ class Widget(object):
         return pygame.Rect(self.pos, self.size)
 
     def render(self, surface):
         return pygame.Rect(self.pos, self.size)
 
     def render(self, surface):
+        '''Draw the widget onto surface'''
         if not self._prepared:
             self.prepare()
             self._prepared = True
         self.draw(surface)
 
     def draw(self, surface):
         if not self._prepared:
             self.prepare()
             self._prepared = True
         self.draw(surface)
 
     def draw(self, surface):
+        '''The overrideable bit of widget drawing'''
         raise NotImplemented()
 
     def prepare(self):
         raise NotImplemented()
 
     def prepare(self):
-        raise NotImplemented()
+        '''Prepare the widget for drawing. This usually caches a surface.'''
 
     def handle_event(self, ev):
 
     def handle_event(self, ev):
+        '''Return True if the event has been handled'''
         return False
 
 
         return False