O'Reilly logo

Python Game Programming By Example by Joseph Howse, Alejandro Rodas de Paz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required