Question: Using graphics.py in python NOT TURTLE or TKINTER draw a game board for playing chess or checkers. Its a simple grid of 8x8 squares, in
Using graphics.py in python NOT TURTLE or TKINTER draw a game board for playing chess or checkers. Its a simple grid of 8x8 squares, in which the squares alternate between two colors and the starting color in each row alternates as well, so that you end up with a checkerboard pattern.
- import the graphics module
- define the main function
- Use GraphWin method to create a chessboard which could be whatever the size you wish it to be. (refer to the method description in graphics.py)
- Use a nested while loop to draw 8 by 8 rectangles and use if else and setFill methods to set the color of the rectangles.
- You can use getMouse method to receive a response from mouse with close method to close the window.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
