Tkinter GUI Application Development Blueprints, Second Edition - Second Edition
by Bhaskar Chaudhary
Making the game functional
Now that we have all the chess pieces and chessboard-related validation rules in place, let's add life to our chess program. In this iteration, we will make our chess game fully functional.
The objective of this iteration is to move the chess pieces with a click of the left mouse button. When a player clicks on a chess piece, the code should first check whether it is a legitimate turn for that chess piece.
On the first click, the chess piece that needs to be moved is selected, and all the allowed moves for that chess piece are highlighted on the chessboard. The second click should be performed on the destination square. If the second click is done on a valid destination square, the chess piece should move from the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access