You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had to write this code to convert from screen coordinates (returned for example from win32gui.GetWindowRect) to find the matching dx device output. It would be nice if dxcam could do this form me so I just specify a region in screen coordinates and it finds the appropriate device and output.
deffind_output(self, region: List[int]) ->Tuple[int, int]:
x, y, w, h=regionp_adapters=enum_dxgi_adapters()
fori, p_adapterinenumerate(p_adapters):
device=Device(p_adapter)
p_outputs=device.enum_outputs()
forj, p_outputinenumerate(p_outputs):
output=Output(p_output)
left=output.desc.DesktopCoordinates.lefttop=output.desc.DesktopCoordinates.topwidth, height=output.resolution# if the region is inside the output then return this monitorifleft<=xandx<=left+widthandtop<=yandy<=top+height:
# raise exception if the bounds overlaps monitorsifx+w>left+widthory+h>top+height:
raiseException(f"Region {region} overlaps multiple monitors")
# adjust region to be relative to this monitorself._region= [x-left, y-top, w, h]
returni, jraiseException(f"Monitor containing region {region} not found")
The text was updated successfully, but these errors were encountered:
I had to write this code to convert from screen coordinates (returned for example from win32gui.GetWindowRect) to find the matching dx device output. It would be nice if dxcam could do this form me so I just specify a region in screen coordinates and it finds the appropriate device and output.
The text was updated successfully, but these errors were encountered: