Building the GUI application

The Checkers module will contain all of the code required for the GUI application. This module depends on wxPython as well as Python's standard threading module to allow us to put all of the intensive computer vision work onto a background thread. Moreover, we will rely on our CheckersModel module for the capturing and analysis of images, and our WxUtils module for its image conversion utility function. Here are the relevant import statements:

import threading
import wx

import CheckersModel
import WxUtils

Our application class, Checkers, is a subclass of wx.Frame, which represents a normal window (not a dialog). We initialize it with an instance of CheckersModel, and a window title (Checkers by default). Here are the ...

Get Python Game Programming By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.