We previously created the Photo class. Now we can add some test code to our module to ensure that it functions as we expect. We can use the __name__ ="__main__" attribute as before to detect whether the module has been run directly or not.
We can add the subsequent section of code at the end of the photohandler.py script to produce the following test application, which looks as follows:
Add the following code at the end of photohandler.py:
#Module test code def dispPreview(aPhoto): """Create a test GUI""" import tkinter as TK #Define the app window app = TK.Tk() app.title("Photo View Demo") #Define ...