  import logging
  import random
  import tkinter as tk
  from tkinter import ttk
  from typing import Any, Callable, cast, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import os
  import sys
  
  from configparser import ConfigParser
  from threading import Event, Lock, Thread
 
</s> remove from configparser import ConfigParser
 </s> add  </s> remove import cv2
 </s> add  </s> remove from dataclasses import dataclass, field
 </s> add  </s> remove from PIL import Image, ImageTk
 </s> add 
from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import logging
  import random
  import tkinter as tk
  from tkinter import ttk
from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import os
  import sys
  
  from configparser import ConfigParser
  from threading import Event, Lock, Thread
keep keep keep keep replace keep keep keep keep keep
 bugfix:
    - preview tool - Prevent tkinter variables from exiting main thread
refactor:
    - preview tool - Split module to smaller sub-modules + docs, locales
Typing:
    - tools.preview.cli
Unit test:
    - tools.preview.viewer 
tools/preview/preview.py