get screen size python
>>> import pyautogui
>>> width, height= pyautogui.size()
>>> print(width)
1366
>>> print(height)
768
get screen size python
>>> import pyautogui
>>> width, height= pyautogui.size()
>>> print(width)
1366
>>> print(height)
768
python screen capture a window
from win32gui import FindWindow, GetWindowRect
from PIL import ImageGrab
from PIL import Image
import numpy as np
import cv2
while True:
window_handle = FindWindow(None, "MTGA")
window_rect = GetWindowRect(window_handle)
screen = np.array(ImageGrab.grab(bbox=(window_rect)))
resized = cv2.resize(screen, (1280, 720), interpolation = cv2.INTER_AREA)
im_rgb = cv2.cvtColor(resized, cv2.COLOR_BGR2RGB)
cv2.imshow('Python Window', im_rgb)
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us