作者you7662000 (My Heart)
看板Python
標題[問題] LINE notify多螢幕截圖
時間Wed Feb 1 09:23:37 2023
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://webptt.com/m.aspx?n=bbs/Python/M.1675214622.A.2F3.html
1F:→ lycantrope: 如果是win32, PIL.ImageGrab.grab本身支援多螢幕截圖 02/01 12:05
2F:→ s860134: Win32 API 可以針對 windows hanlder 截圖 02/01 23:55