A picture may be worth a thousand words, but it takes considerably fewer to display one with Python. The next program, PyView, implements a simple photo slideshow program in portable Python/Tkinter code.
PyView pulls together many of the topics we studied in the last
chapter: it uses
after events to sequence a
slideshow, displays image objects in an automatically sized canvas,
and so on. Its main window displays a photo on a canvas; users can
either open and view a photo directly or start a slideshow mode that
picks and displays a random photo from a directory, at regular
intervals specified with a scale widget.
By default, PyView slideshows show images in the book’s image file directory (though the Open button allows you to load images in arbitrary directories). To view other sets of photos, either pass a directory name in as a first command-line argument or change the default directory name in the script itself. I can’t show you a slideshow in action here, but I can show you the main window in general. Figure 9-13 shows the main PyView window’s default display.
Figure 9-13. PyView without notes
Though it’s not obvious as rendered in this book, the black-on-red label at the top gives the pathname of the photo file displayed. For a good time, move the slider at the bottom all the way over to “0” to specify no delay between photo ...