Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import pygame
  2. import pygame.camera
  3. pygame.init()
  4. pygame.camera.init()
  5. ventana=pygame.display.set_mode((320,240),0)
  6. listaCamaras=pygame.camera.list_cameras()
  7. camara=pygame.camera.Camera(listaCamaras[0],(320,240))
  8. camara.start()
  9. imagen=camara.get_image()
  10. salir=False
  11. nombreArchivo="foto_"
  12. numFoto=1
  13. while not salir:
  14.     for evento in pygame.event.get():
  15.         if evento.type == pygame.QUIT:
  16.             salir=True
  17.     pygame.event.get()
  18.     mouse=pygame.mouse.get_pressed()
  19.     imagen=camara.get_image()
  20.     if mouse[0]==1:
  21.         nombreActual=nombreArchivo+str(numFoto)+".jpg"
  22.         pygame.image.save(imagen,nombreActual)
  23.         numFoto=numFoto+1
  24.     imagen=camara.get_image()
  25.     ventana.blit(imagen,(0,0))
  26.     pygame.display.update()