pyqtgraph/pyqtgraph/util/get_resolution.py
KIU Shueng Chuan f21dfd9d95 fix get_resolution.py to use QScreen
QDesktopWidget is deprecated in Qt5 and removed in Qt6
2021-01-16 14:33:47 +08:00

18 lines
648 B
Python

from .. import mkQApp
from ..Qt import QtGui
def test_screenInformation():
# a qApp is still needed, otherwise screen is None
qApp = mkQApp()
screen = QtGui.QGuiApplication.primaryScreen()
screens = QtGui.QGuiApplication.screens()
resolution = screen.size()
availableResolution = screen.availableSize()
print("Screen resolution: {}x{}".format(resolution.width(), resolution.height()))
print("Available geometry: {}x{}".format(availableResolution.width(), availableResolution.height()))
print("Number of Screens: {}".format(len(screens)))
return None
if __name__ == "__main__":
test_screenInformation()