我希望建立一个Raspberry Pi照相亭触摸屏,并遇到一些超出我的python知识的东西。
我希望用户触摸屏幕以启动该过程,获取三(或四)张图片,然后保存到文件中。我找到了一些如何完成大部分零件的例子,少了整个“计数”项目。我喜欢屏幕显示倒计时实时预览的想法。
我拥有的是:
def countDown(counter):
clearWindow()
if counter == 0:
self.after(100, capturePicture)
countdown = Label(self, text=":)", font=font, width=width, height=height, bg='blue', activebackground='blue').pack()
else:
ct = str(counter)
camera.preview_alpha = 170
countdown = Label(self, text=counter, font=font, width=width, height=height, bg='yellow', activebackground='yellow').pack()
self.after(1000, countDown, counter-1)
def takePhoto():
clearWindow()
camera.start_preview()
otherwise
countDown(5)
def capturePicture():
filename='/home/pi/pb/pictures/img_' + datetime.now().strftime(dateString) + '.jpg'
camera.capture(filename)
camera.stop_preview()
reviewPhoto(filename, 60)
有人可以通过获取具有临时名称的图片来创建文件,从而提供三个或四个从5到1倒计时的指针吗?我已经创建了从20到1倒数的代码,并且背靠背拍摄了四张照片。