【问题标题】:Pygame window does not responding in fullscreen modePygame 窗口在全屏模式下没有响应
【发布时间】:2020-09-30 14:55:00
【问题描述】:

所以当我在 pygame 中使用窗口模式时,一切正常,但如果我使用全屏模式,我的屏幕会变黑,我无法绘制任何内容或更新屏幕(控制台中也没有任何错误)

# works fine
win = pygame.display.set_mode((1920, 1080))

# does not work fine
win = pygame.display.set_mode((1920, 1080), pygame.FULLSCREEN)
# i tried adding flags pygame.HWSURFACE and pygame.DOUBLEBUF, it did not work

这个问题似乎是因为我的操作系统 (openSUSE),因为在 Windows 7 上它在全屏模式下运行良好。

所以我不知道——这是因为缺少一些库或包,还是因为其他原因?

我在这里写了关于我的操作系统和软件规格的文章:

OS: openSUSE Leap 15.2 x64
KDE Plasma version: 5.18.5
Pygame version: 2.0.0dev12 (On pygame 1.9.6 i have the same problem)
Python version: 3.6.10

如果您需要更多信息,请询问,我会将其添加到本文中

【问题讨论】:

    标签: python pygame opensuse


    【解决方案1】:

    我听说有人在 Linux 上遇到全屏 SDL 问题。 另一种方法是使用无边框窗口,例如

    # force window position to be centred
    os.environ["SDL_VIDEO_CENTERED"] = "1"
    pygame.init()
    # get the current screen size
    info = pygame.display.Info()
    width, height = info.current_w, info.current_h
    screen = pygame.display.set_mode((width, height), pygame.NOFRAME)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-12
      • 1970-01-01
      • 2013-12-08
      相关资源
      最近更新 更多