Browse Source

dgui: Fix DirectScrolledList scrollTo error in Python 3

As a rule of thumb, Python 3 divisions always have float results. Unfortunately, this piece of code is still relying on the old Python 2.7 behavior.

Closes #880
Derzsi Dániel 5 years ago
parent
commit
32a9ea2cef
1 changed files with 1 additions and 1 deletions
  1. 1 1
      direct/src/gui/DirectScrolledList.py

+ 1 - 1
direct/src/gui/DirectScrolledList.py

@@ -210,7 +210,7 @@ class DirectScrolledList(DirectFrame):
         numItemsVisible = self["numItemsVisible"]
         numItemsVisible = self["numItemsVisible"]
         numItemsTotal = len(self["items"])
         numItemsTotal = len(self["items"])
         if(centered):
         if(centered):
-            self.index = index - (numItemsVisible/2)
+            self.index = index - (numItemsVisible // 2)
         else:
         else:
             self.index = index
             self.index = index