我想用pygame在Google的协作平台上编写游戏。我已经成功地通过运行以下代码添加了pygame:
import os
!git clone https://github.com/ntasfi/PyGame-Learning-Environment.git
os.chdir('PyGame-Learning-Environment')
!pip install -e .
!pip install pygame
os.chdir('/content')
但是当我写下这段代码时:
import pygame
pygame.init()
BLACK = [0,0,0]
size = [100,100]
screen = pygame.display.set_mode((size))
screen.fill(BLACK)
screen.update()
pygame.quit()
我收到了以下错误信息:
Traceback (most recent call last)
<ipython-input-10-b26800e3009a> in <module>()
BLACK = [0,0,0]
size = [100,100]
screen = pygame.display.set_mode((size))
screen.fill(BLACK)
错误:没有可用的视频设备
有没有办法让pygame检测到笔记本电脑屏幕?