is destroyed independently. As is, this program must wrap the PyEdit classes with its
WrapEditor in order to catch independent destroys of the PyEdit frame when it is run
in either pop-up window or full-option component modes—the note editor can no
longer be accessed or repacked once it’s destroyed. This isn’t an issue in main window
mode (Quit ends the program) or the default minimal component mode (the editor has
no Quit). Watch for PyEdit to show up embedded as a component like this within
another GUI when we meet PyMailGUI in Chapter 14.
A caveat here: out of the box, PyView supports as many photo formats as tkinter’s
PhotoImage object does; that’s why it looks for GIF files by default. You can improve
this by installing the PIL extension to view JPEGs (and many others). But because PIL
is an optional extension today, it’s not incorporated into this PyView release. See the
end of Chapter 8 for more on PIL and image formats.
PyView Source Code
Because the PyView program was implemented in stages, you need to study the union
of two files and classes to understand how it truly works. One file implements a class
that provides core slideshow functionality; the other implements a class that extends
the original class, to add additional features on top of the core behavior. Let’s start with
the extension class: Example 11-6 adds a set of features to an imported slideshow base
class—note editing, a delay scale and file label, and so on. This is the file that is actually
run to start PyView.
Example 11-6. PP4E\Gui\SlideShow\slideShowPlus.py
"""
#############################################################################
PyView 1.2: an image slide show with associated text notes.
SlideShow subclass which adds note files with an attached PyEdit object,
a scale for setting the slideshow delay interval, and a label that gives
the name of the image file currently being displayed;
Version 1.2 is a Python 3.x port, but also improves repacking note for
expansion when it's unhidden, catches note destroys in a subclass to avoid
exceptions when popup window or full component editor has been closed,
and runs update() before inserting text into newly packed note so it is
positioned correctly at line 1 (see the book's coverage of PyEdit updates).
#############################################################################
"""
import os
from tkinter import
from PP4E.Gui.TextEditor.textEditor import
from slideShow import SlideShow
#from slideShow_threads import SlideShow
Size = (300, 550) # 1.2: start shorter here, (h, w)
class SlideShowPlus(SlideShow):
732 | Chapter 11: Complete GUI Programs