Search code examples
python-2.7screen-resolutionpyglet

pyglet resolution of screen into variables


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()

->

>>> 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.


Solution

  • it should be as simple as this:

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