There's more...

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 script to produce the following test application, which looks as follows:

The Photo View Demo application

Add the following code at the end of

#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 ...

Get Getting Started with Python for the Internet of Things now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.