'pygetwindow appears to not have a getWindowGeomtry attribute. what is wrong here?
ok so I'm trying to take a screenshot wiht pyautogui, and to do so i need the coordinates of the window so I was going to use pygetwindow's getWindowGeometry function but aparently its not there! What is throwing me off more than anything is that the pycharm auto-completion shows getWindowGeometry as an existing function within pygetwindow here are both my code and the error.
code:
import pygetwindow
import pyautogui
from PIL import Image
path = './src/detection_result.png'
x1, y1, width, height = pygetwindow.getWindowGeometry('mediapipe_face_detection')
x2 = x1+width
y2 = y1+height
pyautogui.screenshot(path)
im = Image.open(path)
im = im.crop((x1, y1, x2, y2))
im.save(path)
error:
Traceback (most recent call last):
File "C:\Users\ascar\Desktop\face_mesh\foo.py", line 6, in <module>
x1, y1, width, height = pygetwindow.getWindowGeometry('mediapipe_face_detection')
AttributeError: module 'pygetwindow' has no attribute 'getWindowGeometry'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
