Pygame:设置视频模式而不显示显示
基本上我需要在显示显示(窗口)之前使用 pygame.Surface.convert_alpha() ,但尝试这样做会引发以下异常:
image = image.convert_alpha()
pygame.error: No video mode has been set
我该怎么做?
Basically I need to use pygame.Surface.convert_alpha()
before showing a display (a window), but trying to do so raises the following exception:
image = image.convert_alpha()
pygame.error: No video mode has been set
How can I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这条消息可能很旧,但它可以帮助其他人:
这工作正常,但以一种肮脏的方式:
This message might be old but it could help somebody else:
this works fine, in a dirty way :
显然答案是你不能。
无论如何,这实际上是毫无意义的,因为除非您先设置显示,否则您无法显示精灵,
convert_alpha
或其他方式。我所做的实际上是以下内容:
Apparently the answer is that you can't.
It's actually kind of pointless anyway, since you can't display a sprite,
convert_alpha
'd or otherwise, unless you set a display first.What I did is actually the following:
您必须设置视频模式:
You have to set video mode: