I'm just wondering if it is possible for me to get the resolution of a monitor in Pygame and then use these dimensions to create a window so that launching the program detects the monitor resolution and then automatically fits the window to the screen in fullscreen.
I am currently using pygame.display.set_mode((AN_INTEGER, AN_INTEGER))
to create the window.
I am aware that you can get video info including the monitor resolution using pygame.display.Info()
but how can I extract these values and then use them in pygame.display.set_mode()
???
Thanks in advance, Ilmiont
You can use
pygame.display.Info()
:The docs say:
pygame.display.Info()
creates an Info Object with the attributescurrent_h
andcurrent_w
. Create the Info Object before you calldisplay.set_mode
and then calldisplay.set_mode
withcurrent_h
andcurrent_w
from the object.Example:
I don't know if this will work, but if you just want a fullscreen window use the following:
(of course you still have to
import pygame
).I don't know much about pygame, but here is a way using the module
win32api
:Update: After taking a glance at the docs, seems like you can get it from
pygame.display.Info
, like this:Hope this helps!