Issue
Can I take a screenshot from desktop or any window with PyQt? How to handle keyPressEvent on desktop?
Thanks.
Solution
Example of how to take a screenshot of the desktop:
import sys
from PyQt4.QtGui import QPixmap, QApplication
app = QApplication(sys.argv)
QPixmap.grabWindow(QApplication.desktop().winId()).save('screenshot.jpg', 'jpg')
If you want to take a screenshot of a specific window, replace QApplication.desktop()
with the widget you want to take a screenshot of.
Answered By - Tommy Brunn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.