美文网首页PYQT5学习与开发
PYQT5(十三)配合微信截图并保存图片

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

作者: 弗兰克万岁 | 来源:发表于2018-12-06 18:04 被阅读289次

# -*- 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

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

相关文章

网友评论

    本文标题:PYQT5(十三)配合微信截图并保存图片

    本文链接:https://www.haomeiwen.com/subject/knzocqtx.html