from pathlib import Path import tkinter as tk RESOURCE_DIR = Path(__file__).resolve().parent / "resources" _cache = {} def load_image(name): if name not in _cache: _cache[name] = tk.PhotoImage(file=str(RESOURCE_DIR / name)) return _cache[name]