Files
Tagger/src/ui/utils.py
2026-01-24 07:50:19 +01:00

23 lines
505 B
Python

"""
UI utility functions for Tagger GUI (PySide6).
"""
from pathlib import Path
from PySide6.QtGui import QIcon, QPixmap
def load_icon(path: str | Path, size: int = 16) -> QIcon:
"""
Load an icon from file and optionally resize.
Args:
path: Path to the image file
size: Icon size in pixels (default 16)
Returns:
QIcon object
"""
pixmap = QPixmap(str(path))
if not pixmap.isNull():
pixmap = pixmap.scaled(size, size)
return QIcon(pixmap)