Answer the question
In order to leave comments, you need to log in
How to write the interval between 1 and 35 in If?
My code:
import pyscreenshot as ImageGrab
import time
import cv2
import pyautogui
import keyboard
import pytesseract
from ahk import AHK
def aboba():
pyautogui.press('enter'), pyautogui.typewrite('/homefast'), pyautogui.press('enter')
print("хом")
time.sleep(2)
time.sleep(1)
while True:
if __name__ == "__main__":
im = ImageGrab.grab(bbox=(190, 1011, 209, 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)
if HP in range(1 - 35):
aboba()
Answer the question
In order to leave comments, you need to log in
It seems to me that the answer from this question is quite applicable to this one: https://qna.habr.com/q/1085468
hpInt = int(HP)
if hpInt >= 1 and hpInt <= 35:
aboba()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question