Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Examples

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial