)
self.info_btn.place(relx=1.0, x=-4, y=2, anchor="ne")
+ # 打开日志按钮
+ self.log_btn = tk.Button(
+ self.root,
+ text="📁 打开日志",
+ font=("Segoe UI", 9),
+ bg="#E0E0E0",
+ fg="#333333",
+ bd=1,
+ cursor="hand2",
+ command=self._open_log,
+ )
+ self.log_btn.place(relx=0.5, rely=0.62, anchor="center")
+
# 中央开关按钮
self.toggle_btn = tk.Button(
self.root,
self._resend_link_sent = False
log.info("监控已停用")
+ # ── open log ──
+ def _open_log(self):
+ """打开日志文件所在的目录"""
+ log_dir = os.path.dirname(os.path.abspath(__file__))
+ log_file = os.path.join(log_dir, "wechat_monitor.log")
+ if os.path.exists(log_file):
+ os.startfile(log_file)
+ else:
+ try:
+ # 尝试打开日志目录
+ os.startfile(log_dir)
+ except Exception:
+ pass
+
# ── status ──
def _set_status(self, text):
self.status_var.set(text)