#!/usr/bin/env python#-*- encoding:utf-8 -*-# screenshot.pyfrom PyQt4.QtGui import QApplication, QPixmapfrom os import environ, mkdir, listdirfrom sys import argvfrom time import strftime, gmtimeclass Screenshot(object): def __init__(self): self.usuario = environ['USER'] if not 'screenshot' in listdir('./'): mkdir('screenshot') def capturarPantalla(self): time = strftime("%d %b %Y_%H:%M:%S", gmtime()) imagen = './screenshot/' + self.usuario + '_' + time + '.png' app = QApplication(argv) winId = QApplication.desktop().winId() width = QApplication.desktop().screenGeometry().width() height = QApplication.desktop().screenGeometry().height() captura = QPixmap.grabWindow(winId, 0, 0, width, height) captura.save(imagen)def main(): ss = Screenshot() ss.capturarPantalla()if __name__ == '__main__': main()
#!/usr/bin/env python#-*- encoding:utf-8 -*-# webcamCapture.pyfrom pygame.image import saveimport pygame.camera as camerafrom os import environ, mkdir, listdirfrom time import strftime, gmtimeclass WebcamCapture(object): def __init__(self): camera.init() misWebcams = camera.list_cameras() if len(misWebcams) == 0: raise Exception('No hay webcam disponible.') exit() elif len(misWebcams) == 1: self.miWebcam = misWebcams[0] else: for i in range(len(misWebcams)): try: self.miWebcam = misWebcams[i] break except: continue def capturar(self): try: webcam = camera.Camera(self.miWebcam,(640,480)) webcam.start() self.captura = webcam.get_image() webcam.stop() except Exception as e: print e def guardarCaptura(self): self.usuario = environ['USER'] if not 'webcam' in listdir('./'): mkdir('webcam') tiempo = strftime("%d %b %Y_%H:%M:%S", gmtime()) imagen = './webcam/' + self.usuario + '_' + tiempo + '.png' save(self.captura, imagen)def main(): wcCapture = WebcamCapture() wcCapture.capturar() wcCapture.guardarCaptura()if __name__ == '__main__': main()
abc = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j','k', 'l', 'm', 'n', 'ñ',\ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x','y', 'z', 'A', 'B', 'C',\ 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M','N', 'Ñ', 'O', 'P', 'Q',\ 'R', 'S', 'T', 'U', 'V','W', 'X', 'Y', 'Z']num = [34, 0, 2, 10, 51, 29, 18, 0, 2, 10]for n in num: print abc[n],
envirion['USER']