How do I get monitor resolution in Python?

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

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

30条回答
  •  礼貌的吻别
    2020-11-22 14:36

    If you are using the Qt toolkit specifically PySide, you can do the following:

    from PySide import QtGui
    import sys
    
    app = QtGui.QApplication(sys.argv)
    screen_rect = app.desktop().screenGeometry()
    width, height = screen_rect.width(), screen_rect.height()
    

提交回复
热议问题