Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions taskon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def main():
root.geometry("250x350")
root.config(padx=5, pady=5, bg="#fdfdfd")
root.resizable(False, False)
root.iconbitmap("assets/images/growing-seed.ico")

# Load all necessary image resources
loader = ResourceLoader()

icon_path = loader.get_resource_path("growing-seed.ico")
root.iconbitmap(icon_path)

images = {
"moon": loader.load_image("clock-green.png"),
"oak": loader.load_image("growing-seed.png"),
Expand Down
12 changes: 12 additions & 0 deletions taskon/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ def load_image(self, filename: str):
"""
path = os.path.join(self.base_path, filename)
return PhotoImage(file=path) if os.path.exists(path) else None

def get_resource_path(self, filename: str) -> str:
"""
Get the absolute file path for a resource file.

Args:
filename: Name of the resource file.

Returns:
Absolute path to the resource file.
"""
return os.path.join(self.base_path, filename)