tuikit/scrollbar.py
changeset 3 33ec838dc021
parent 0 a35731b5e31a
child 9 7175ed629a76
--- a/tuikit/scrollbar.py	Tue Mar 15 17:27:09 2011 +0100
+++ b/tuikit/scrollbar.py	Wed Mar 16 15:19:05 2011 +0100
@@ -26,7 +26,9 @@
 
     def setpos(self, pos):
         self.pos = pos
-        self.thumbpos = int(round(self.pos / self.max * (self.height - 3)))
+        self.thumbpos = 0
+        if self.max and self.pos <= self.max:
+            self.thumbpos = int(round(self.pos / self.max * (self.height - 3)))
 
 
     def on_draw(self, screen, x, y):