Exemplo n.º 1
0
    def introButtons(self):
        def loadGame():
            print("Loading game...")
            Button1.removeNode()
            Button2.removeNode()
            imageObject.destroy()
            self.loadGame()

        imageObject = OnscreenImage(image='stat_board.png', pos=(0, 0, 0))
        imageObject.setTransparency(TransparencyAttrib.MAlpha)

        Button1 = DirectButton(
            frameSize=None,
            text="Load Game",
            image=(self.ButtonImage.find('**/QuitBtn_UP'),
                   self.ButtonImage.find('**/QuitBtn_DN'),
                   self.ButtonImage.find('**/QuitBtn_RLVR')),
            relief=None,
            command=loadGame,
            text_pos=(0, -0.015),
            geom=None,
            pad=(0.01, 0.01),
            suppressKeys=0,
            pos=(-.85, -0, -.93),
            text_scale=0.059999999999999998,
            borderWidth=(0.015, 0.01),
            scale=.7)

        Button1.setPosHprScale(0.00, 0.00, 0.30, 0.00, 0.00, 0.00, 2.53, 2.53,
                               2.53)

        Button2 = DirectButton(
            frameSize=None,
            text="Customize",
            image=(self.ButtonImage.find('**/QuitBtn_UP'),
                   self.ButtonImage.find('**/QuitBtn_DN'),
                   self.ButtonImage.find('**/QuitBtn_RLVR')),
            relief=None,
            command=loadGame,
            text_pos=(0, -0.015),
            geom=None,
            pad=(0.01, 0.01),
            suppressKeys=0,
            pos=(-.85, -0, -.93),
            text_scale=0.059999999999999998,
            borderWidth=(0.015, 0.01),
            scale=.7)

        Button2.setPosHprScale(0.00, 0.00, -0.30, 0.00, 0.00, 0.00, 2.53, 2.53,
                               2.53)
Exemplo n.º 2
0
def buttons(self, text):
    def toggleSomething():
        print("test")
        Button1.removeNode()
        sys.exit()


    Button1 = DirectButton(frameSize=None, text=text, image=(self.ButtonImage.find('**/QuitBtn_UP'),
                                                          self.ButtonImage.find('**/QuitBtn_DN'),
                                                          self.ButtonImage.find('**/QuitBtn_RLVR')),
                        relief=None, command=toggleSomething, text_pos=(0, -0.015),
                        geom=None, pad=(0.01, 0.01), suppressKeys=0, pos=(-.85, -0, -.93),
                        text_scale=0.059999999999999998, borderWidth=(0.015, 0.01), scale=.7)

    Button1.setPosHprScale(0.00, 0.00, 0.30, 0.00, 0.00, 0.00, 2.53, 2.53, 2.53)