I want to load an image from webcam to display on pygame
I am using videocapture
from VideoCapture import Device
import pygame
import time
In=1
pygame.init()
w = 640
h = 480
size=(w,h)
screen = pygame.display.set_mode(size)
while True:
cam = Device()
cam.saveSnapshot(str(In)+".jpg")
img=pygame.image.load(In)
screen.blit(img,(0,0))
In=int(In)+1
In=str(In)
Why does this not work.Pygame window opens but nothing displays?
You have to tell pygame to update the display.
Add the following line in your loop after blitting the image to the screen:
BTW, you probably want to limit how much images you take per second. Either use
time.sleepor a pygame clock.