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
Fix window icon on linux
  • Loading branch information
JesseMFrey committed Jan 22, 2022
commit 76702d2f7d3b1b6b207b2fb2f51c1e38ebb32a06
Binary file added mcvqoe/hub/MCV-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions mcvqoe/hub/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from os import path

import importlib.resources
import sys
import tkinter as tk
from tkinter import ttk
import tkinter.filedialog as fdl
Expand All @@ -16,6 +17,7 @@
import mcvqoe.hub.loadandsave as loadandsave
from .tk_threading import show_error, Abort_by_User, InvalidParameter
from .tk_threading import SingletonWindow
from _tkinter import TclError

from mcvqoe.simulation import QoEsim

Expand All @@ -26,10 +28,18 @@

#find MCV icon and add set as window icon
def add_mcv_icon(win):
with importlib.resources.path('mcvqoe.hub','MCV-sm.ico') as icon:
img_ext = 'ico' if sys.platform.startswith('win') else 'png'
with importlib.resources.path('mcvqoe.hub','MCV-sm.'+img_ext) as icon:
if icon:
#set the title- and taskbar icon
win.iconbitmap(icon)
try:
if img_ext == 'ico':
#set the title- and taskbar icon
win.iconbitmap(icon)
else:
logo = tk.PhotoImage(file=icon)
win.call('wm', 'iconphoto', win._w, logo)
except TclError as e:
print(f'failed to add icon : {icon}, {e}')
else:
print('Could not find icon file')

Expand Down