How do I get monitor resolution in Python?

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

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

30条回答
  •  时光取名叫无心
    2020-11-22 14:42

    You could use PyMouse. To get the screen size just use the screen_size() attribute:

    from pymouse import PyMouse
    m = PyMouse()
    a = m.screen_size()
    

    a will return a tuple, (X, Y), where X is the horizontal position and Y is the vertical position.

    Link to function in documentation.

提交回复
热议问题