1 Commits

Author SHA1 Message Date
SitiWeb
43c5bdac8c Add image processor PNG file to UI assets 2026-01-23 16:53:14 +01:00
5 changed files with 39 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ exe = EXE(
upx_exclude=[],
runtime_tmpdir=None,
console=False,
icon='ui/images/image_processor.ico',
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,

30
main.py
View File

@@ -1,8 +1,10 @@
"""
Main module for the Image Processor application.
"""
from PIL import Image
from PIL import Image, ImageTk
import customtkinter as ctk
import os
import sys
from ui.menu import MenuBar # Import the new MenuBar class
from ui.log_frame import LogWindow
from ui.button_frame import ButtonFrame
@@ -15,6 +17,15 @@ from controller import AppController
from ui.preview_frame import PreviewFrame # Import the new PreviewFrame class
def resource_path(relative_path: str) -> str:
"""Get absolute path to a resource (dev or PyInstaller)."""
try:
base_path = sys._MEIPASS # type: ignore[attr-defined]
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
class ImageProcessorApp:
"""
@@ -34,6 +45,23 @@ class ImageProcessorApp:
self.root.title("Image Processor")
self.root.geometry("553x800")
# Window/taskbar icon (Windows prefers .ico)
try:
ico_path = resource_path("ui/images/image_processor.ico")
if os.path.exists(ico_path):
self.root.iconbitmap(ico_path)
except Exception:
pass
# Cross-platform icon (uses PNG)
try:
png_path = resource_path("ui/images/image_processor.png")
if os.path.exists(png_path):
self._icon_photo = ImageTk.PhotoImage(Image.open(png_path))
self.root.iconphoto(True, self._icon_photo)
except Exception:
pass
# Initialize the controller
self.controller = AppController(self.root)

View File

@@ -3,8 +3,12 @@ import glob
import os
# -*- mode: python ; coding: utf-8 -*-
# Collect all PNG and JPG images in the ui/images directory
image_files = [(file, "ui/images") for file in glob.glob("ui/images/*.*") if file.endswith(('.png', '.jpg', '.jpeg'))]
# Collect UI images/icons in the ui/images directory
image_files = [
(file, "ui/images")
for file in glob.glob("ui/images/*.*")
if file.lower().endswith((".png", ".jpg", ".jpeg", ".ico"))
]
block_cipher = None
@@ -33,7 +37,7 @@ exe = EXE(
a.zipfiles,
a.datas,
[],
name='main',
name='image_processor',
debug=False,
bootloader_ignore_signals=False,
strip=False,
@@ -41,6 +45,8 @@ exe = EXE(
upx_exclude=[],
runtime_tmpdir=None,
icon='ui/images/image_processor.ico',
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB