immediately loading when you click the mouse.
If you just want to show your friends and neighbors vacation pictures, you can leave out this
optimization. In that case, the photos will continuously feed to the screen in a continuous loop.
The Optimized Presentation
The HD image presentation script, with all of its “speed” modifications, has changed quite a bit.
Listing 23.3 shows some of the new script, script2302.py, which is available to download at
informit.com/title/9780789752055.
LISTING 23.3 The Optimized script2302.py Presentation Script
Click here to view code image
...
##### Import Functions & Variables #######
#
from os import listdir, system #Import from OS module
#
#Import from PyGame Library
from pygame import event, font, display, image, init, transform
#
from sys import exit #Import from System module
#
from pygame.locals import * #Load PyGame constants
#
init() #Initialize PyGame
#
# Set up Picture Variables ######################
...
# Set up Presentation Text #######################
#
# Color #
#
RazPiRed = 210,40,82
#
# Font #
#
DefaultFont='/usr/share/fonts/truetype/freefont/FreeSans.ttf'
PrezFont=font.Font(DefaultFont,60)
#
# Text #
#
IntroText1="Our Trip to the"
IntroText2="Raspberry Capital of the World"
IntroText1=PrezFont.render(IntroText1,True,RazPiRed)
IntroText2=PrezFont.render(IntroText2,True,RazPiRed)
#
# Set up the Presentation Screen ################
#
ScreenColor = Gray = 125,125,125
#
ScreenFlag = FULLSCREEN | NOFRAME | DOUBLEBUF
PrezScreen = display.set_mode((0,0),ScreenFlag)
#
PrezScreenRect = PrezScreen.get_rect()
CenterScreen = PrezScreenRect.center
AboveCenterScreen = CenterScreen[0],CenterScreen[1]-100