示例#1
0
    def onclose_character_selector(self, selected_char):
        ''' This method is called when the Screen_character_selector closes.
            selected_char should contain the index in the list of the character selected by the user.
            The method manages the assignment of the player and computer objects and then starts the
            Prepare for Battle page.
            '''
        selected_char = int(selected_char)

        # Saves players character choice
        self.player = self.character_choices.get_and_remove_character(
            selected_char)

        # Gets a player for the computer.
        self.computer = self.character_choices.get_random_character()

        # Destroys the "Character Selection" frame
        self.char_sel.destroy()

        # Retitle the main frame.
        self.root.title("The Combatants!")

        # Creates the "Prepare to Battle" frame
        self.prepare = Screen_prepare_to_battle(self.root, self.player,
                                                self.computer,
                                                self.onclose_prepare_to_battle,
                                                self.onback_prepare_to_battle)
示例#2
0
    def onclose_character_selector(self):
        ''' This method is called when the Screen_character_selector closes. 
            selected_char should contain the index in the list of the character selected by the user. 
            The method manages the assignment of the player and computer objects and then starts the 
            Prepare for Battle page.
            '''
        self.root.title("The Combatants!")

        # Creates the "Prepare to Battle" frame
        self.prepare = Screen_prepare_to_battle(self.root, self.player,
                                                self.computer,
                                                self.onclose_prepare_to_battle)