This can be done by executing PowerShell command from your python script.
To discover multi-monitor configuration information on your computer you use powershell Get-WmiObject win32_desktopmonitor command. Command output looks like this:
__GENUS : 2
__CLASS : Win32_DesktopMonitor
__SUPERCLASS : CIM_DesktopMonitor
__DYNASTY : CIM_ManagedSystemElement
__RELPATH : Win32_DesktopMonitor.DeviceID="DesktopMonitor1"
__PROPERTY_COUNT : 28
__DERIVATION : {CIM_DesktopMonitor, CIM_Display, CIM_UserDevice,
CIM_LogicalDevice...}
__SERVER : SQUALL
__NAMESPACE : root\cimv2
__PATH : \\SQUALL\root\cimv2:Win32_DesktopMonitor.DeviceID
="DesktopMonitor1"
Availability : 3
Bandwidth :
Caption : LG IPS237(Analog)
ConfigManagerErrorCode : 0
ConfigManagerUserConfig : False
CreationClassName : Win32_DesktopMonitor
Description : LG IPS237(Analog)
DeviceID : DesktopMonitor1
DisplayType :
ErrorCleared :
ErrorDescription :
InstallDate :
IsLocked :
LastErrorCode :
MonitorManufacturer : LG
MonitorType : LG IPS237(Analog)
Name : LG IPS237(Analog)
PixelsPerXLogicalInch : 96
PixelsPerYLogicalInch : 96
PNPDeviceID : DISPLAY\GSM587D\5&2494DFB6&0&UID1048848
PowerManagementCapabilities :
PowerManagementSupported :
ScreenHeight : 1080
ScreenWidth : 1920
Status : OK
StatusInfo :
SystemCreationClassName : Win32_ComputerSystem
SystemName : SQUALL
We need to get section Name, so use regex.
The final code is:
import subprocess
import re
proc = subprocess.Popen(['powershell', 'Get-WmiObject win32_desktopmonitor;'], stdout=subprocess.PIPE)
res = proc.communicate()
monitors = re.findall('(?s)\r\nName\s+:\s(.*?)\r\n', res[0].decode("utf-8"))
print(monitors)
The result is:
['LG IPS237(Analog)']