我正在创建一个简单的python脚本,它使用gphoto2从usb连接的相机中拍摄照片,feh用来显示照片。在
当我运行程序时,gphoto2将捕获照片,feh将打开它,但我想返回命令行拍摄另一张照片,而不必手动关闭图像窗口。在
有没有什么方法可以让我在不关闭图像窗口的情况下从命令行连续运行程序?在class PhotoBooth(object):
def capture_photo(self):
filename = join(out, '%s.jpg' % str(uuid4()))
subprocess.call('gphoto2 --capture-image-and-download --filename="%s"' % filename, shell=True)
return filename
def print_photo(self, filename):
subprocess.Popen('feh --g 640x480 ' + filename, shell=True)
photobooth = PhotoBooth()
try:
while True:
raw_input("Press enter to capture photo")
filename = photobooth.capture_photo()
photobooth.print_photo(filename)
except keyboardInterrupt:
print "\nExiting..."