GUI module

class GUI.GUI

Bases: object

This class encompases the graphical user interface and its methods.

Attributes
  • screen (pygame.display)

    GUI screen shown to user

  • SQUARESIZE (int)

    size of 1 square on the GUI screen

  • WIDTH (int)

    width of GUI screen

  • HEIGHT (int)

    height of GUI screen

  • SIZE (tuple)

    (WIDTH,HEIGHT) of GUI screen

  • RADIUS (int)

    size of game piece radius

  • BLUE (RGB thruple)

    BLUE color

  • BLACK (RGB thruple)

    BLACK color

  • RED (RGB thruple)

    RED color

  • YELLOW (RGB thruple)

    YELLOW color

  • BLUE (RGB thruple)

    BLUE color

  • FONT (pygame.font)

    FONT of text for GUI screen

draw_board(board)

A function to draw the current board on the GUI screen.

Parameters

board – board object to draw

Board type

Board.Board

Returns

None

game_over(winner, waitTime)

A function to display a message to the winner, wait a few seconds, then close the game Window.

Parameters
  • winner (int) – player who won the game

  • waitTime (int) – time to wait before closing window (milliseconds)

Returns

None

mouse_piece(mousePosition, turn)

A function to display the appropriate piece at the player’s current mouse .

Parameters
  • mousePosition (int) – current mouse position on screen

  • turn (int) – current turn count

Returns

None

wait(waitTime)

A function to make the screen wait for given time in milliseconds.

Parameters

waitTime (int) – time to wait before closing window (milliseconds)

Returns

None