Gracefully Exit Script Function
def Graceful_Exit ():
mixer.music.stop() #Stop any music.
mixer.quit() #Quit mixer
time.delay(3000) #Allow things to shutdown
Command = "sudo umount " + PictureDisk
system(Command) #Unmount disk
exit()
Set up Picture Variables
PictureDirectory = '/home/pi/pictures'
PictureFileExtension = '.jpg'
PictureDisk = '/dev/sda1'
Mount the Picture Drive
Command = "sudo umount " + PictureDisk + " 2>/dev/null"
system(Command)
Command = "sudo mount -t vfat " + PictureDisk + " " + PictureDirectory
system(Command)
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="Why Our School Should"
IntroText2="Use Raspberry Pi's and Teach Python"
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
PrezScreenSize = PrezScreen.get_size()
Scale=PrezScreenSize[0]-20,PrezScreenSize[1]-20
Run the Presentation
Queue up the Music
Load_Music()