“pygame.error:没有可用的视频设备”在复制上
我不断收到错误:pygame.error:没有可用的视频设备
。 这适用于在 Windows 上安装 python 3.10 时出现的 python 默认 IDLE,但不适用于 Replit(Online IDLE)。
我将 pygame 安装到 Relpit 中,如你所见 此处
我从这部分代码中收到错误:
import pygame
import math
pygame.init()
WIDTH, HEIGHT = 800, 800
WIN = pygame.display.set_mode((WIDTH, HEIGHT)) <<<-- ERROR LINE
pygame.display.set_caption("Planet Simulation")
这是输出:
pygame 2.1.2 (SDL 2.0.16, Python 3.8.12)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "main.py", line 6, in <module>
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.error: No available video device
所以我的问题是,这是 IDLE 故障还是代码错误。另外我该如何修复它?
I keep receiving Error: pygame.error: No available video device
.
This works on python default IDLE that comes when installing python 3.10 on Windows but doesn't work with Replit(Online IDLE).
I installed pygame into Relpit as you can see
here
I'm getting Error from this part of the code:
import pygame
import math
pygame.init()
WIDTH, HEIGHT = 800, 800
WIN = pygame.display.set_mode((WIDTH, HEIGHT)) <<<-- ERROR LINE
pygame.display.set_caption("Planet Simulation")
This is the the Output:
pygame 2.1.2 (SDL 2.0.16, Python 3.8.12)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "main.py", line 6, in <module>
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.error: No available video device
So my question is, Is this the IDLE fault or is the code wrong. Also How do I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 repllit,您必须确保使用提供的 pygame 模板 - 您可以从提供的链接中搜索该模板 - 创建“特殊项目”时非常简单:
,它应该可以修复它!
With replit you have to make sure to use the provided pygame template - which you can search for from the link provided - when creating a "special project" so simply:
and it should fix it!