Snapshot/SnapshotRegionGrabber.py

changeset 2131
e79d0610347a
parent 2106
cca04724bff8
child 2194
0fce40af66b8
equal deleted inserted replaced
2130:626f6fe486be 2131:e79d0610347a
8 """ 8 """
9 9
10 from PyQt4.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, qVersion 10 from PyQt4.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, qVersion
11 from PyQt4.QtGui import QWidget, QPixmap, QColor, QRegion, QApplication, QPainter, \ 11 from PyQt4.QtGui import QWidget, QPixmap, QColor, QRegion, QApplication, QPainter, \
12 QPalette, QToolTip, QPaintEngine, QPen, QBrush 12 QPalette, QToolTip, QPaintEngine, QPen, QBrush
13 if qVersion() >= "5.0.0":
14 from PyQt4.QtGui import QScreen
15 13
16 def drawRect(painter, rect, outline, fill=QColor()): 14 def drawRect(painter, rect, outline, fill=QColor()):
17 """ 15 """
18 Module function to draw a rectangle with the given parameters. 16 Module function to draw a rectangle with the given parameters.
19 17
108 """ 106 """
109 self.__desktop = QApplication.desktop() 107 self.__desktop = QApplication.desktop()
110 x = self.__desktop.x() 108 x = self.__desktop.x()
111 y = self.__desktop.y() 109 y = self.__desktop.y()
112 if qVersion() >= "5.0.0": 110 if qVersion() >= "5.0.0":
113 self.__pixmap = QScreen.grabWindow(self.__desktop.winId(), x, y, 111 self.__pixmap = QApplication.screens()[0].grabWindow(
112 self.__desktop.winId(), x, y,
114 self.__desktop.width(), self.__desktop.height()) 113 self.__desktop.width(), self.__desktop.height())
115 else: 114 else:
116 self.__pixmap = QPixmap.grabWindow(self.__desktop.winId(), x, y, 115 self.__pixmap = QPixmap.grabWindow(self.__desktop.winId(), x, y,
117 self.__desktop.width(), self.__desktop.height()) 116 self.__desktop.width(), self.__desktop.height())
118 self.resize(self.__pixmap.size()) 117 self.resize(self.__pixmap.size())

eric ide

mercurial