pyglet 将屏幕分辨率转换为变量

2024-01-18

有没有任何选项如何获取值height and width使用 pyglet 将屏幕转换为变量?我可以打印它,但无法提取这些值。

import pyglet

platform = pyglet.window.get_platform()
display = platform.get_default_display()
screen = display.get_screens()

->

>>> screen
[XlibScreen(display=<pyglet.canvas.xlib.XlibDisplay object at 0x7f4644cf0990>, x=0, y=0, width=1366, height=768, xinerama=0)]
>>> 

任何想法?提前致谢。


在新版本中pygletpyglet.window.get_platform() 已弃用/删除proof https://web.archive.org/web/20180725142633/http://pyglet.readthedocs.io/en/pyglet-1.3-maintenance/modules/window.html#pyglet.window.get_platform
因此代码将如下所示:

    display = pyglet.canvas.Display()
    screen = display.get_default_screen()
    screen_width = screen.width
    screen_height = screen.height
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pyglet 将屏幕分辨率转换为变量 的相关文章

随机推荐