Переглянути джерело

*** empty log message ***

Joe Shochet 25 роки тому
батько
коміт
52e8eb7482
1 змінених файлів з 25 додано та 25 видалено
  1. 25 25
      direct/src/gui/Button.py

+ 25 - 25
direct/src/gui/Button.py

@@ -13,32 +13,32 @@ class Button(DirectObject):
         self.name = name
         self.name = name
         # if no label given, use the button name
         # if no label given, use the button name
         if (label == None):
         if (label == None):
-            self.label = name
+            label = self.name
+
+        # check to see if this is an actual guiLabel or just text
+        if (type(label) == type('')):
+            # text label, make text button
+            self.label = label
+            # up
+            self.l1 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label,
+                                                            font)
+            self.l1.setForegroundColor(0., 0., 0., 1.)
+            self.l1.thaw()
+            # roll-over up
+            self.l2 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label,
+                                                            font)
+            self.l2.setForegroundColor(0., 0., 0., 1.)
+            self.l2.setBackgroundColor(1., 1., 0., 1.)         
+            self.l2.thaw()
+            # roll-over down
+            self.l3 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label,
+                                                            font)
+            self.l3.setForegroundColor(1., 1., 1., 1.)
+            self.l3.setBackgroundColor(0., 0., 0., 1.)
+            self.l3.thaw()
         else:
         else:
-            # check to see if this is an actual guiLabel or just text
-            if (type(label) == type('')):
-                # text label, make text button
-                self.label = label
-                # up
-                self.l1 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label,
-                                                                font)
-                self.l1.setForegroundColor(0., 0., 0., 1.)
-                self.l1.thaw()
-                # roll-over up
-                self.l2 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label,
-                                                                font)
-                self.l2.setForegroundColor(0., 0., 0., 1.)
-                self.l2.setBackgroundColor(1., 1., 0., 1.)         
-                self.l2.thaw()
-                # roll-over down
-                self.l3 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label,
-                                                                font)
-                self.l3.setForegroundColor(1., 1., 1., 1.)
-                self.l3.setBackgroundColor(0., 0., 0., 1.)
-                self.l3.thaw()
-            else:
-                # label provided, use it for all labels
-                self.l1 = self.l2 = self.l3 = label
+            # label provided, use it for all labels
+            self.l1 = self.l2 = self.l3 = label
 
 
         self.button = GuiButton.GuiButton(self.name, self.l1, self.l2,
         self.button = GuiButton.GuiButton(self.name, self.l1, self.l2,
                                           self.l3, self.l3, self.l1)
                                           self.l3, self.l3, self.l1)