Created
August 14, 2014 03:35
-
-
Save meoow/fd064db781f802b3d905 to your computer and use it in GitHub Desktop.
Take screenshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt4.QtGui import QPixmap, QApplication | |
import os | |
namebase='screenshit_' | |
num=1 | |
outdir= os.path.abspath(os.path.join(os.environ['HOMEPATH'],'Documents')) | |
while os.path.exists(os.path.join(outdir,namebase+str(num)+'.png')): | |
num+=1 | |
fulloutname = os.path.join(outdir, namebase + str(num) + '.png') | |
app = QApplication(sys.argv) | |
QPixmap.grabWindow(QApplication.desktop().winId()).save(fulloutname,'png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment