首页 > 其他分享 >Mac执行pyautogui.screenshot()只能截取桌面背景

Mac执行pyautogui.screenshot()只能截取桌面背景

时间:2023-09-12 12:44:25浏览次数:36  
标签:pyautogui screenshot 开发工具 桌面背景 Mac 权限

明明有程序窗口在前台,却只获取到桌面背景。
如果无法正确的获取截屏,那么pyautogui.locateCenterOnScreenpyautogui.locateOnScreen等函数都无法正确执行。

原因很简单,就是权限问题。
应将屏幕录制权限开放给你的开发工具。
这里我赋予Anaconda-Navigator 和 Terminal 屏幕录制权限。
前往 System Settings > Privacy & Security > Screen Recording

【根据你实际使用的开发工具进行勾选】

标签:pyautogui,screenshot,开发工具,桌面背景,Mac,权限
From: https://www.cnblogs.com/ZJT7098/p/17695865.html

相关文章

  • Mac执行pyautogui.screenshot()时报错
    报错信息---------------------------------------------------------------------------TypeErrorTraceback(mostrecentcalllast)CellIn[3],line1---->1pyautogui.screenshot()File~/anaconda3/lib/python3.11/site-package......
  • Python - 桌面自动化(PyAutoGUI)
    一、安装windows:pipinstallpyautogui-ihttps://pypi.tuna.tsinghua.edu.cn/simplemac:pipinstallpyobjc-corepipinstallpyobjcpipinstallpyautoguilinux:sudoapt-getinstallscrotpython3-tkpython3-devpipinstallpython3-xlibpipinstallpyautog......
  • python+playwright 学习-80 v1.37版本新增--full-page-screenshot 用例失败截长图
    前言--full-page-screenshot参数是pytest-playwright在使用,在失败时是否进行完整页面截图。默认情况下,仅捕获视口。需开启--screenshot开关(默认:off).用例失败截图环境准备:1.安装playwright最新v1.37版本2.安装pytest-playwright0.4.2版本用例示例fromplaywright.......
  • QQScreenShot
    QQScreenShot​#截图工具QQ截图#​一、介绍从QQ中提取出的“QQ截图,有以下功能:高斯模糊马赛克OCR文字识别序号备注指定区域录屏其他参考原QQ截图二、安装开源地址:https://github.com/insoxin/QQScreenShot下载地址:https://github.com/insoxin/QQScreenShot/releases......
  • Python3 pyautogui安装成功,但是不能引用
    安装使用的是pycharm,python3.8python-mpipinstallpyautogui-ihttps://pypi.tuna.tsinghua.edu.cn/simple,显示Successfully。 引用importpyautogui报错:Nomodulenamed'pyautogui'解决办法尝试各种网上的方法,查询环境等,不太懂,感觉没有问题偶然发现虽然piplist有......
  • 利用pyautogui处理IE下载文件另存为
    defdownload_file(file_name):'''IE下载,提示要打开或保存。。。,这里是另存为'''pyperclip.copy(file_name)time.sleep(1)#从ie界面切换到下载提示pyautogui.press('f6')time.sleep(0.5)pyautogui.press('tab')......
  • python自动化办公--pyautogui控制鼠标和键盘操作
    ✅作者简介:热爱科研的算法开发者,Python、Matlab项目可交流、沟通、学习。......
  • 解决方案 | pyautogui实现等待特定图片(对话框)出现(可设置等待超时时间)
    1、问题为了等待某个【转换完毕】的图片(对话框)出现,如何设置?   2、解决方案代码如下下面代码实现的是:设置超时时间为10s,当你在完成前序工作以后,代码开始进入等待,一旦你的特定图片出现了,马上探测到它的位置并且实现点击按钮。(注意:如果等待时间超过了10s,那么就会返回提示:T......
  • Ubuntu - Add a Flameshot Icon for taking screenshot directly to Applications men
    Allapplications'desktopentriescanbefoundin/usr/share/applications.Youcancreateadesktopentryunder~/.local/share/applicationstomakeyourownicon.zzh@ZZHPC:/usr/share/applications$sudocporg.flameshot.Flameshot.desktop~/.local/sh......
  • pyautogui.screenshot('test.png') 报错:PyAutoGUI was unable to import pyscreeze (T
    根据提示需要importpyscreeze还需要Pillow.通过pip3list可以查看到已经安装PyScreeze==0.1.29但是不是我手动安装的,应该是Pillow或者pyautogui下载的时候依赖了pyscreeze并且安装了最新版本0.1.29。通过依赖树可以看到是pyautogui依赖了sudopip3installpipdeptree安装查......