if name == 'main':
import sys
if len(sys.argv) == 2:
picdir = sys.argv[1]
else:
picdir = '../gifs'
root = Tk()
root.title('PyView 1.2')
root.iconname('PyView')
Label(root, text="Python Slide Show Viewer").pack()
SlideShow(root, picdir=picdir, bd=3, relief=SUNKEN)
root.mainloop()
To give you a better idea of what this core base class implements, Figure 11-16 shows
what it looks like if run by itself—actually, two copies run by themselves by a script
called slideShow_frames, which is in this book’s examples distribution, and whose main
code looks like this:
root = Tk()
Label(root, text="Two embedded slide shows: Frames").pack()
SlideShow(parent=root, picdir=picdir, bd=3, relief=SUNKEN).pack(side=LEFT)
SlideShow(parent=root, picdir=picdir, bd=3, relief=SUNKEN).pack(side=RIGHT)
root.mainloop()
Figure 11-16. Two attached SlideShow objects
The simple slideShow_frames scripts attach two instances of SlideShow to a single win-
dow—a feat possible only because state information is recorded in class instance var-
iables, not in globals. The slideShow_toplevels script (also in the book’s examples
distribution) attaches two SlideShows to two top-level pop-up windows instead. In both
PyView: An Image and Notes Slideshow | 737