capture -- live preview
authorTomas Musil <tomik.musil@gmail.com>
Fri, 7 Sep 2012 21:39:27 +0000 (23:39 +0200)
committerTomas Musil <tomik.musil@gmail.com>
Fri, 7 Sep 2012 21:39:27 +0000 (23:39 +0200)
capture.py

index 9b93ba6..dbaef64 100755 (executable)
@@ -43,11 +43,27 @@ def main():
 
     im_number = 0
 
-    saving_dir = "./captured/" + time.strftime("%Y-%m-%d %H:%M")
+    saving_dir = "./captured/" + time.strftime("%Y-%m-%d %H:%M/")
 
     if not os.path.isdir(saving_dir):
         os.makedirs(saving_dir)
-    
+
+    done = False
+    clock = pygame.time.Clock()
+    while not done: #live preview
+        for event in pygame.event.get():
+            if event.type == pygame.QUIT:
+                done = True
+                del cam
+                sys.exit()
+            if event.type == pygame.KEYDOWN:
+                done = True
+
+        im = cam.get_image()
+        screen.display_picture(im)
+        clock.tick(5)
+
+   
     if args.a > 0:
         last = 0
         clock = pygame.time.Clock()