import pyscreenshot as ImageGrab
import time
import cv2
import pyautogui
import pytesseract
def aboba():
pyautogui.press('enter'), pyautogui.typewrite('/homefast'), pyautogui.press('enter')
print("хом")
time.sleep(1)
time.sleep(1)
while True:
if __name__ == "__main__":
im = ImageGrab.grab(bbox=(190, 1011, 215, 1023)) # X1,Y1,X2,Y2
im.save('screen.png')
img = cv2.imread('screen.png')
img = cv2.resize(img, None, fx=9, fy=9)
HP = pytesseract.image_to_string(img, config='outputbase digits')
print(HP)
hpInt = int(HP[:-1])
if 0 < hpInt and hpInt < 35:
aboba()