Files
douyin_guaji-main/gui/components/ocr_panel.py
T
Your Name 223c127e11 chore: Clean up and refactor codebase for improved maintainability
- Removed obsolete command-line test parameters from `run_cli.py` to streamline functionality.
- Introduced a new `ocr_preprocess.py` module for unified OCR image preprocessing, enhancing recognition stability.
- Updated various components to utilize the new preprocessing function, improving code organization and readability.
- Adjusted configuration values in `config.json` for better performance and consistency.
- Added comprehensive technical documentation for the Douyin project, detailing code modification standards and operational guidelines.
- Cleaned up excessive blank lines across multiple files to enhance overall readability.
2025-12-30 23:11:34 +08:00

75 lines
859 B
Python

"""OCR面板组件
包含OCR区域配置、截图OCR等功能的GUI组件。
"""
from __future__ import annotations
from typing import Any, Callable
import tkinter as tk
from tkinter import ttk
def create_ocr_panel(
parent: Any,
device_var: tk.StringVar,
y_var: tk.IntVar,
on_line: Callable[[str], None],
) -> tuple[Any, Callable[[], None]]:
"""创建OCR面板组件。
参数:
parent: 父容器
device_var: 设备ID变量
y_var: Y偏移变量
on_line: 日志输出回调
返回:
(ocr_results_var, do_screenshot_func)
"""
ocr_results_var = {"results": []}
def do_screenshot() -> None:
"""执行截图和OCR识别。"""
# TODO: 从原文件迁移函数实现
pass
return ocr_results_var, do_screenshot