Screnschoting desktop...
-
Hey
I'm trying to screnschot desktop behind widget location >
def getImage(self) -> QPixmap: r = self.rect() po = self.pos() p = self.screen().grabWindow(0, abs(po.x()), abs(po.y()), abs(r.width()), abs(r.height())) self.label.setPixmap(p) return pBut the problem that I have is, if I have 2/3/4 screens and I move my widget out of main screen. The coordinates are no longer correct to take screnschot and I end up with scrazy pics. If I have 1 screen above other one in physical space and so on.
Any idea how to convert coordinatest to correct screen coordinate to get correct x/y coords? -
grabWindow()works in the screen's coordinates andpos()is in absolute coordinates, so get the screen's geometry() and subtract the top left corner coordinates of it from your rectangle pos.