P
P
Proritsatel2020-08-28 21:44:53
Python
Proritsatel, 2020-08-28 21:44:53

How to take a screenshot from two displays using python?

Good day!
Advise how you can take a screenshot from different external devices.
I have a display and a TV connected to my computer via hdmi, I found a lib for python
pyautogui on the network, I wrote a function that takes a screenshot, but it takes a screenshot from the main monitor
How to detect additional monitors? I didn't find any such items in the manual.

def print_screen(name):
    image = pyautogui.screenshot(region=(0, 0, 1920, 1080))
    image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
    cv2.imshow('Screenshot', imutils.resize(image, width=1200))
    cv2.imwrite(name+'.png', image)
    print(list(pyautogui.locateAllOnScreen(name+'.png')))
    position = pyautogui.locateOnScreen('screen1.jpg')
    print(position)


Please advise the means to accomplish my task

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-08-28
@Proritsatel

Google suggests using this module https://python-mss.readthedocs.io/examples.html com/r/learnpython/comments/99fe... ImageGrab too https://stackoverflow.com/questions/9185797/how-to...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question