There’s always trusty old Qt.
# From within Maya
import os
from PySide.QtGui import QPixmap, QApplication
app = QApplication.instance()
screenshot = QPixmap.grabWindow(app.desktop().winId())
screenshot.save(os.path.expanduser("~/screenshot.jpg"), "jpg")
It can do regions too.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy9tEcVdFsyQsn8OvRAiC6bXs854nDjFCdS_C2qGb-140A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I knew I needed to take a look at taking screenshots when this was originally posted and had saved Marcus’ excellent snippet for now. I just noticed Pixmap.grabWindow has been replaced by QScreen.grabWindow in Qt5 (PySide2/PyQt5).
So since Pixmap.grabWindow has been marked as “obsolete” you may want to take not of that: http://doc.qt.io/qt-5/qpixmap-obsolete.html
// Fredrik
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWMyU9bpNYo8m4H5kJsoFPW_FPppJsEgWuMqsns%2BgwBSvQ%40mail.gmail.com.
Anybody has this for maya2017?