Show application logo in custom title bar

This commit is contained in:
lm 2025-10-17 14:12:24 +02:00
parent f49a13b80e
commit 9093e7c835
1 changed files with 18 additions and 1 deletions

View File

@ -352,6 +352,23 @@ class UIBuilderMixin:
title_bar.pack(fill=tk.X, side=tk.TOP)
title_bar.pack_propagate(False)
logo = None
try:
from PIL import Image, ImageTk # type: ignore
logo_path = Path(__file__).resolve().parents[1] / "logo.png"
if logo_path.exists():
image = Image.open(logo_path).convert("RGBA")
image.thumbnail((26, 26))
logo = ImageTk.PhotoImage(image)
except Exception:
logo = None
if logo is not None:
logo_label = tk.Label(title_bar, image=logo, bg=bar_bg)
logo_label.image = logo # keep reference
logo_label.pack(side=tk.LEFT, padx=(10, 6), pady=4)
title_label = tk.Label(
title_bar,
text="ICRS — Interactive Color Range Analyzer",
@ -360,7 +377,7 @@ class UIBuilderMixin:
font=("Segoe UI", 11, "bold"),
anchor="w",
)
title_label.pack(side=tk.LEFT, padx=12)
title_label.pack(side=tk.LEFT, padx=6)
close_btn = tk.Button(
title_bar,