From: Tomas Musil Date: Fri, 7 Sep 2012 21:39:27 +0000 (+0200) Subject: capture -- live preview X-Git-Url: http://git.tomasm.cz/imago.git/commitdiff_plain/b0d73e96d68198be32495d7b36505c6d2e3f6810?ds=sidebyside capture -- live preview --- diff --git a/capture.py b/capture.py index 9b93ba6..dbaef64 100755 --- a/capture.py +++ b/capture.py @@ -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()