Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This section provides several straightforward examples of how to capture images, save them to disk, and render them on the display. As we progress, more advanced applications are covered in later chapters. Comments are included in the code to provide guidance about what is happening at each step along the way.
The examples below also use the time module from Python’s standard library, which we first introduced in the updated Hello World program. Experienced Python programmers may already be familiar with this module. In these examples, it is used to create timers that cause a program to wait for a specified interval of time. For instance, one example below captures an image every second. The timer is used to control the interval between snapping new photos.