PYQT5(十三)配合微信截图并保存图片

# -*- coding:utf-8 -*-

import ctypes

import os

from PyQt5.QtWidgets import QApplication

def capture():

    clipboard=QApplication.clipboard()

    try:

        dll = ctypes.cdll.LoadLibrary('PrScrn.dll')

        dataImage = clipboard.pixmap()

        dataImage.save('Grab.png')

    except Exception:

        print("Dll load error!")

        return

    else:

        try:

            dll.PrScrn(0)

            dataImage = clipboard.pixmap()

            dataImage.save('Grab.png')

        except Exception:

            print("Sth wrong in capture!")

            return

主要是使用剪贴板传递图片并保存

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 【本站讯】为了让同学们更好的学习科学知识,激发同学们对科学的兴趣,12月3日,由校团委主办,校科技协会承办的科普大...
    真椅子阅读 488评论 0 0