Browse Source

dgui: resolve DirectFrame regression

Closes #810
Derzsi Dániel 6 years ago
parent
commit
9455fb3f73
1 changed files with 5 additions and 4 deletions
  1. 5 4
      direct/src/gui/DirectFrame.py

+ 5 - 4
direct/src/gui/DirectFrame.py

@@ -67,13 +67,14 @@ class DirectFrame(DirectGuiWidget):
         """Recreates the given component using the given keyword args."""
         assert name in ("geom", "image", "text")
 
-        if len(states) != self['numStates']:
-            raise ValueError
-
         # constants should be local to or default arguments of constructors
         for c in range(self['numStates']):
             component_name = name + str(c)
-            state = states[c]
+
+            try:
+                state = states[c]
+            except IndexError:
+                state = states[-1]
 
             if self.hascomponent(component_name):
                 if state is None: