Files
douyin_guaji-main/gui/components/stats_display.py
T
Your Name 26df350755 feat: Implement 30-minute timeout protection and unify path configurations
- Introduced a 30-minute timeout mechanism to prevent the script from getting stuck in invalid states, with configurable timeout settings.
- Unified path configurations across the project to enhance maintainability and avoid hardcoded paths.
- Updated documentation and flowcharts to reflect the new timeout feature and improved path management.
- Fixed issues with template and screenshot path configurations to ensure consistency across the project.
2025-12-28 14:47:31 +08:00

48 lines
1.0 KiB
Python

"""统计显示组件
包含统计信息显示和刷新功能的GUI组件。
"""
from __future__ import annotations
from typing import Any, Callable, Tuple
from tkinter.scrolledtext import ScrolledText
try:
from ttkbootstrap.scrolled import ScrolledText as TBSrolledText
ScrolledText = TBSrolledText
except ImportError:
from tkinter.scrolledtext import ScrolledText
def create_stats_display(
parent: Any,
runner: Any,
status_var: Any
):
"""创建统计显示组件。
参数:
parent: 父容器
runner: 运行器对象
status_var: 状态变量
返回:
(stats_text, refresh_stats_func) 统计文本框和刷新函数
"""
stats_text = ScrolledText(parent)
stats_text.pack(fill="both", expand=True, padx=10, pady=10)
try:
stats_text.configure(font=("Consolas", 10))
except Exception:
pass
def refresh_stats() -> None:
"""刷新统计信息。"""
# TODO: 从原文件迁移函数实现
pass
return stats_text, refresh_stats