2024-05-23 15:28:40 发布
网友
我目前正试图让pygame在我的Ubuntu20.04机器上运行。在收到错误“没有可用的视频设备”后,我添加了以下代码行:
import os os.environ['SDL_VIDEODRIVER'] = 'dummy'
现在错误信息消失了,但窗口仍然没有弹出。。。 我正在使用python 3.8.3和pygame 2.0.0.dev10
有人知道我错过了什么吗
因为将SDL_VIDEODRIVER设置为"dummy"实际上不会呈现任何内容As stated at the bottom of the wiki:
SDL_VIDEODRIVER
"dummy"
If you need an event queue but don't want a real window, try putenv("SDL_VIDEODRIVER=dummy") before you call SDL_SetVideoMode. I find this useful in apps that use SDL facilities, but don't need a real video output device.
由于您使用的是Linux,因此需要将SDL_VIDEODRIVER的值设置为可以找到here的一个Linux视频驱动程序
如果它仍然无法工作,您可能需要重新安装视频驱动程序或something is wrong with one of your SDL packages,并且可能需要重新安装它们
因为将
SDL_VIDEODRIVER
设置为"dummy"
实际上不会呈现任何内容As stated at the bottom of the wiki:由于您使用的是Linux,因此需要将
SDL_VIDEODRIVER
的值设置为可以找到here的一个Linux视频驱动程序如果它仍然无法工作,您可能需要重新安装视频驱动程序或something is wrong with one of your SDL packages,并且可能需要重新安装它们
相关问题 更多 >
编程相关推荐