#
PrezScreenSize = PrezScreen.get_size()
Scale=PrezScreenSize[0]-20,PrezScreenSize[1]-20
#
###### Run the Presentation #######################################
#
while True:
# Introduction Screen ##############################
#
PrezScreen.fill(ScreenColor)
#
# Put Intro Text Line 1 above Center of Screen
IntroText1Location = IntroText1.get_rect()
IntroText1Location.center = AboveCenterScreen
PrezScreen.blit(IntroText1,IntroText1Location)
#
# Put Intro Text Line 2 at Center of Screen
IntroText2Location = IntroText2.get_rect()
IntroText2Location.center = CenterScreen
PrezScreen.blit(IntroText2,IntroText2Location)
#
display.update()
#
#Get HD Pictures ###################################
#
for Picture in listdir(PictureDirectory):
if Picture.endswith(PictureFileExtension):
Picture = PictureDirectory + '/' + Picture
#
Picture = image.load(Picture)
#
Continue = 0
# Show next Picture with Mouse
while Continue == 0:
for Event in event.get():
if Event.type == MOUSEBUTTONDOWN:
Continue = 1
if Event.type in (QUIT,KEYDOWN):
Command = "sudo umount " + PictureDisk
system(Command)
exit()
...
Potential Script Modifications
Hopefully, as you read through the script in Listing 23.3, you thought of many improvements you could
make. You have come a long way in learning Python! You may have noted improvements and changes
such as these:
Rewrite the script using tkinter, which is covered in Hour 18, “GUI Programming.”
Write an additional script which allows the creation of a configuration file that dictates where
files are located and the file extensions of pictures. Modify the presentation script to use the
information in the configuration file.
Add to the script a dictionary that contains text to be displayed along with each image.
Modify the script to determine the device file name on the fly, so it does not have to be
determined beforehand.