您好我正在使用pyqt5获取小部件的快照我正在使用此代码,但我无法创建类QScreen的对象 我收到一个错误:
PyQt5.QtGui.QScreen无法实例化或细分
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QPixmap,QScreen
from PyQt5.QtWidgets import QApplication
from datetime import datetime
date = datetime.now()
filename = date.strftime('%Y-%m-%d_%H-%M-%S.jpg')
app = QApplication(sys.argv)
sc=QtGui.QScreen()
sc.grabWindow(QApplication.desktop().winId()).save(filename, 'jpg')