How do I get monitor resolution in Python?

后端 未结 30 1457
深忆病人
深忆病人 2020-11-22 13:49

What is the simplest way to get monitor resolution (preferably in a tuple)?

30条回答
  •  抹茶落季
    2020-11-22 14:37

    Using pygame:

    import pygame
    pygame.init()
    infos = pygame.display.Info()
    screen_size = (infos.current_w, infos.current_h)
    

    [1]

    However, if you're trying to set your window to the size of the screen, you might just want to do:

    pygame.display.set_mode((0,0),pygame.FULLSCREEN)
    

    to set your display to fullscreen mode. [2]

提交回复
热议问题