MyTetra Share
Делитесь знаниями!
grabWindow(0) / захват скриншота = return Pixmap
Время создания: 16.04.2017 14:13
Раздел: Python - PyQt5 - Структура классов - PyQt5 - QtGui - QScreen
Запись: xintrea/mytetra_db_mcold/master/base/1492341217yama8lc0b4/text.html на raw.githubusercontent.com

def shootScreen(self):
if self.delaySpinBox.value() != 0:
QApplication.instance().beep()
# звуковой сигнал

screen = QApplication.primaryScreen() # тип данных QScreen
if screen is not None:
self.originalPixmap = screen.grabWindow(0)
else:
self.originalPixmap = QPixmap()


QPixmap QScreen::grabWindow(WId windowint x = 0, int y = 0, int width = -1, intheight = -1)

Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by QRect(xywidthheight).

The arguments (xy) specify the offset in the window, whereas (widthheight) specify the area to be copied. If width is negative, the function copies everything to the right border of the window. If height is negative, the function copies everything to the bottom of the window.

The window system identifier (WId) can be retrieved using the QWidget::winId() function. The rationale for using a window identifier and not a QWidget, is to enable grabbing of windows that are not part of the application, window system frames, and so on.

 
MyTetra Share v.0.65
Яндекс индекс цитирования