def captureAlbumArt(self):
while(self.windowHandle != GetForegroundWindow()):
SetForegroundWindow(self.windowHandle)
time.sleep(WAIT_TIME) ## Give Spotify a moment to come to the foreground
ShowWindow(self.windowHandle, SW_SHOWMAXIMIZED)
time.sleep(WAIT_TIME) ## Give Spotify a second to become maximized
## Get the edges of the window
left, top, right, bottom = GetWindowRect(self.windowHandle)
left += self.artOffsets[0]
bottom -= self.artOffsets[1]
## Get the album art's location from those edges and user specified offsets.
region = (left, bottom - self.artSideLength, left + self.artSideLength, bottom)
return pyscreenshot.grab(bbox=region, childprocess=False)
评论列表
文章目录