Reputation: 633
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.
Upvotes: 3
Views: 2569
Reputation: 504
In new versions of pyglet
pyglet.window.get_platform() is deprecated/removed proof
Therefore code will look like:
display = pyglet.canvas.Display()
screen = display.get_default_screen()
screen_width = screen.width
screen_height = screen.height
Upvotes: 8
Reputation: 345
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
Upvotes: 7