看板 Python 關於我們 聯絡資訊
HI 各位早安, 小弟是新手,目前正在學習python,透過網站上面的教學有成功使用Line 推播截圖 我螢幕的視窗都有成功傳到指定的對象,但我想知道如果我今天有2-6個螢幕 (筆電HDMI輸出或桌機外顯有8 HDMI ports)我是否能透過pyautogui將這個每個螢幕的視窗 都截出來?,另外這個模組是否可以截部分大小? 以下是我的程式碼 import pyautogui import requests import time def screenshot(): myScreenshot = pyautogui.screenshot() myScreenshot.save('./test.png') def sendLineNotify(msg): url = 'https://notify-api.line.me/api/notify' token = 'token' headers = { 'Authorization': 'Bearer ' + token } data = { 'message':msg } image = open('./test.png', 'rb') imageFile = {'imageFile' : image} data = requests.post(url, headers=headers, data=data, files=imageFile) for i in range(5): screenshot() time.sleep(5) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.163.62.214 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1675214622.A.2F3.html
lycantrope: 如果是win32, PIL.ImageGrab.grab本身支援多螢幕截圖 02/01 12:05
s860134: Win32 API 可以針對 windows hanlder 截圖 02/01 23:55
s860134: http://codepad.org/wUD1m2Wy 可以參考 02/02 00:12