We have called the shift method from the on_square_clicked method. The code for the shift method is responsible for the collection of the necessary arguments that are required for the shift operation.
The code for the shift method is as follows:
def shift(self, start_pos, end_pos): selected_piece = self.controller.get_piece_at(start_pos) piece_at_destination = self.controller.get_piece_at(end_pos) if not piece_at_destination or piece_at_destination.color != selected_piece.color: try: self.controller.pre_move_validation(start_pos, end_pos) except exceptions.ChessError as error: self.info_label["text"] = error.__class__.__name__ else: self.update_label(selected_piece, start_pos, end_pos)
The code ...