Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hours

(singke) #1
os.system(Command)

Remember that the PictureDirectory variable was set earlier to /home/pi/pictures.
The files on the removable hard drive will now be available in the /home/pi/pictures
directory. (Don’t worry if this concept is a little confusing to you. It is an advanced Linux concept!)


Watch Out!: Removable Drive Format
The majority of removable hard drives are formatted using VFAT. However, some
have been formatted using NTFS. If your removable hard drive is NTFS, you need to
change the -t vfat to -t ntfs in the mount command line of the script.

Now you have set up your presentation screen, found the image files, and even incorporated the use of
a removable hard drive into your Python script. However, you need to resolve a few more issues
before you are ready to conduct your presentation.


Scaling the Photos


When you don’t always know what the presentation screen size will be, you can end up with
oversized photos on a screen that’s too small. Figure 23.4 shows how an oversized photo might look
on a small screen. In this photo, it appears that you are trying to show your audience a picture of a
particular chip. However, you are really trying to show a picture of an entire Raspberry Pi.


FIGURE 23.4 A photo sized incorrectly for the display screen.

To ensure that your photos are properly sized, you need to determine the size of the current
presentation screen. The .get_size operation helps with this. When the presentation screen is
originally set up, you have your script determine the size of the current screen and assign it to a
variable. Then you set up a variable called Scale, to be used to scale down any oversized pictures,

Free download pdf