Skip to content

Commit

Permalink
feat: Add icon from python side Create icon for app #11
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeshir26 committed Aug 25, 2023
1 parent 98247f7 commit dff7df2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Binary file added assets/icon.icns
Binary file not shown.
Binary file added assets/icon.ico
Binary file not shown.
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 17 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pathlib import Path
from platform import system
from tkinter import Event, Menu, Tk, messagebox
from tkinter import Event, Menu, PhotoImage, Tk, messagebox, TclError
from tkinter.ttk import Button, Combobox, Entry, Frame, Label

from platformdirs import user_data_dir
Expand Down Expand Up @@ -68,7 +68,7 @@ def __init__(self):
self.withdraw()

# Set up Menubar
if system() == "Darwin":
if SYSTEM == "Darwin":
self.menubar = Menu(self)

# Apple menus have special names and special commands
Expand All @@ -95,6 +95,21 @@ def __init__(self):
self.resizable(False, False)
self.configure(bg="white")

# Set up icon
try:
if SYSTEM == "darwin":
self.iconbitmap("./assets/icon.icns")
elif SYSTEM == "Windows":
self.iconbitmap("./assets/icon.ico")
else:
logo_img = PhotoImage(file="./assets/icon.png")
self.iconphoto(False, logo_img)
except TclError:
try:
self.iconphoto("./assets/icon.ico")
except TclError:
pass

# Set up widgets
self.main_frame = Frame(self)
self.main_frame.grid()
Expand Down

0 comments on commit dff7df2

Please sign in to comment.