问题
I helping out on an FOSS application which uses PyQt 5. It is a dual screen application, and I would like to track the monitors that get connected, and persist settings if they get disconnected.
We're using QScreen for the info we need, and this is great, but on Windows and on Linux the 'serialNumber' property returns an empty string, as does the 'manufacturer' and 'model' properties.
import sys
from PyQt5 import QtGui
app = QtGui.QGuiApplication(sys.argv)
print(repr(app.screens()[0].serialNumber()))
Any suggestions on how I can obtain the serial number?
For Windows the snippet at https://www.activexperts.com/admin/scripts/wmiscripts/python/0073/ works, but I have found no way of relating this information to the X & Y position of the monitor:
来源:https://stackoverflow.com/questions/55182931/get-monitor-serial-number-using-pyqt