import pytesseract
from PIL import Image, ImageGrab
import tkinter as tk
import threading
print(pytesseract.pytesseract.tesseract_cmd)


# 定义截图和OCR识别函数
def capture_and_ocr(region):
    # 读取屏幕截图
    screenshot = ImageGrab.grab(bbox=region)
    
    # 使用Tesseract进行文字识别
    result = pytesseract.image_to_string(screenshot, lang='chi_sim')
    return result
    
