修改calman灰阶点击异常、修改色准结果显示异常
This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
@@ -93,6 +94,11 @@ class TkLogHandler(logging.Handler):
|
||||
def emit(self, record: logging.LogRecord) -> None: # noqa: D401
|
||||
if getattr(record, _FROM_GUI_FLAG, False):
|
||||
return
|
||||
# Tkinter widgets are not thread-safe. Forwarding background-thread logs
|
||||
# into GUI controls may block/hang the worker thread. Keep those logs in
|
||||
# file handlers only, and only mirror main-thread logs to GUI.
|
||||
if threading.current_thread() is not threading.main_thread():
|
||||
return
|
||||
try:
|
||||
message = self.format(record)
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user