Skip to content

Instantly share code, notes, and snippets.

@T31337
Last active August 29, 2015 14:04
Show Gist options
  • Save T31337/a2df581d6ccf03037273 to your computer and use it in GitHub Desktop.
Save T31337/a2df581d6ccf03037273 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#WebCam Test
import pygame,sys
import pygame.camera
from pygame.locals import *
pygame.init()
pygame.camera.init()
screen = pygame.display.set_mode((640,480))
cam = pygame.camera.Camera("/dev/video0",(640,480))
cam.start()
while 1:
image = cam.get_image()
screen.blit(image,(0,0))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment