これはとても簡単です。
from VideoCapture import Device
from os.path import join, exists
# We need to import these two functions so that we can determine if
# a file exists.
import time
# From your question I'm implying that you want to execute the snapshot
# every few seconds or minutes so we need the time.sleep function.
cam = Device()
# First since you want to set a variable to hold the directory into which we
# will be saving the snapshots.
snapshotDirectory = "/tmp/" # This assumes your on linux, change it to any
# directory which exists.
# I'm going to use a while loop because it's easier...
# initialize a counter for image1.jpg, image2.jpg, etc...
counter = 0
# Set an amount of time to sleep!
SLEEP_INTERVAL = 60 * 5 # 5 minutes!
while True:
snapshotFile = join(snapshotDirectory, "image%i.jpg" % counter)
# This creates a string with the path "/tmp/image0.jpg"
if not exists(snapshotFile):
cam.saveSnapshot(snapshotFile)
time.sleep(SNAPSHOT_INTERVAL)
# if the snapshot file does not exist then create a new snapshot and sleep
# for a few minutes.
#finally increment the counter.
counter = counter + 1
それだけです。それはまさにあなたが望むことをするはずです。