屏幕的pyglet分辨率转换为变量 [英] pyglet resolution of screen into variables

查看:79
本文介绍了屏幕的pyglet分辨率转换为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何选项如何使用 pyglet 将屏幕的 heightwidth 值转换为变量?我可以打印它但不能提取这些值.

is there any options how to get values height and width of screen into variables using pyglet? I am able to print it but not extract these values.

import pyglet

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

->

, x=0, y=0, width=1366, height=768, xinerama=0)]>>>

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

有什么想法吗?提前致谢.

Any idea? Thanks in advance.

推荐答案

应该就是这么简单:

platform = pyglet.window.get_platform()
display = platform.get_default_display()      
screen = display.get_default_screen()
screen_width = screen.width
screen_height = screen.height

这篇关于屏幕的pyglet分辨率转换为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆