【发布时间】:2017-08-26 17:14:46
【问题描述】:
您好,我编写了一个使用网络摄像头的程序,但是当我通过 py2exe 制作 exe 它因为这个错误而崩溃。
这是我的代码
import pygame.camera
import pygame.image
import sys
pygame.camera.init()
cameras = pygame.camera.list_cameras()
webcam = pygame.camera.Camera(cameras[0])
webcam.start()
# grab first frame
img = webcam.get_image()
WIDTH = img.get_width()
HEIGHT = img.get_height()
screen = pygame.display.set_mode( ( WIDTH, HEIGHT ) )
pygame.display.set_caption("pyGame Camera View")
while True :
for e in pygame.event.get() :
if e.type == pygame.QUIT :
sys.exit()
# draw frame
screen.blit(img, (0,0))
pygame.display.flip()
# grab next frame
img = webcam.get_image()
谢谢:)
【问题讨论】:
标签: python windows pygame webcam py2exe