From ad162ef7d74aebf8debae824ac574591f1083692 Mon Sep 17 00:00:00 2001 From: HONOR Date: Wed, 16 Sep 2026 11:25:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E7=BD=AE=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=A0=8F=E5=9B=BE=E6=A0=87=E5=B9=B6=E5=B0=86?= =?UTF-8?q?=E5=85=B6=E6=89=93=E5=8C=85=E8=BF=9B=E5=8F=AF=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + src/ui/gui.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index d9da849..36021ad 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ pip install pyinstaller ```powershell pyinstaller -F -w ` --icon="app.ico" ` + --add-data "app.ico;." ` --hidden-import "win32com.client" ` --hidden-import "pythoncom" ` --hidden-import "pywintypes" ` diff --git a/src/ui/gui.py b/src/ui/gui.py index e593c14..8966dcb 100644 --- a/src/ui/gui.py +++ b/src/ui/gui.py @@ -19,6 +19,18 @@ class BatchTableExtractorApp: self.root.title("WordTableExtractor") self.root.geometry("640x520") self.root.minsize(580, 460) + + # 尝试设置窗口图标 + try: + import sys + if getattr(sys, 'frozen', False): + icon_path = os.path.join(sys._MEIPASS, "app.ico") + else: + icon_path = os.path.join(APP_DIR, "app.ico") + if os.path.exists(icon_path): + self.root.iconbitmap(icon_path) + except Exception: + pass # 状态变量 self.mode_var = tk.StringVar(value="dir") # "file" 或 "dir"