明明有程序窗口在前台,却只获取到桌面背景。
如果无法正确的获取截屏,那么pyautogui.locateCenterOnScreen
或pyautogui.locateOnScreen
等函数都无法正确执行。
原因很简单,就是权限问题。
应将屏幕录制权限开放给你的开发工具。
这里我赋予Anaconda-Navigator 和 Terminal 屏幕录制权限。
前往 System Settings > Privacy & Security > Screen Recording
【根据你实际使用的开发工具进行勾选】
标签:pyautogui,screenshot,开发工具,桌面背景,Mac,权限 From: https://www.cnblogs.com/ZJT7098/p/17695865.html