Guest User

Untitled

a guest
Feb 20th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import thread
  2. from vii.camera import Camera
  3.  
  4. class Process(object):
  5.  
  6. def __init__(self, width=800, height=600):
  7. self._cam = Camera(width, height)
  8. self._is_running = False
  9. self._current_image = None
  10.  
  11. def start(self):
  12. thread.start_new(self._run(), (self))
  13.  
  14. def _run(self):
  15. self._cam.start()
  16. self._is_running = True
  17.  
  18. while self._is_running:
  19. self._current_image = self._cam.update()
  20. self._current_image.show()
  21.  
  22. def get_image(self):
  23. return self._current_image
  24.  
  25. def stop(self):
  26. self._is_running = False
  27. self._cam.close()
  28. thread.exit()
  29.  
  30.  
  31. process = Process()
  32. process.start()
  33.  
  34. print("You will never see this output")
  35.  
  36. while (True):
  37. key = raw_input()
  38.  
  39. if key == 'q':
  40. process.stop()
  41. break
Add Comment
Please, Sign In to add comment