import pygame
import pygame.camera
from pygame.locals import *
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0",(640,480))
cam.start()
image = cam.get_image()
这就是我的代码到目前为止......但我得到了这个错误......
**Traceback (most recent call last):
File "C:/Users/Ghost/Desktop/Test", line 8, in <module>
cam = pygame.camera.Camera("/dev/video0",(640,480))
File "C:\Python27\lib\site-packages\pygame\_camera_vidcapture.py", line 50, in __init__
self.dev = vidcap.new_Dev(device, show_video_window)
TypeError: an integer is required**
我在代码中做错了什么?我是编程新手,所以我不知道从哪里开始
答案 0 :(得分:0)
就我而言。
编辑这样的代码。
cam = pygame.camera.Camera("/dev/video0",(640,480))
↓
cam = pygame.camera.Camera(0,(640,480))
&#34;的/ dev / video0的&#34; - &GT;它意味着Linux文件夹路径