diff options
author | emkael <emkael@tlen.pl> | 2022-03-15 22:55:55 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2022-03-15 22:55:55 +0100 |
commit | c2dab703b1a364ee000f222714cbb9dccf736f92 (patch) | |
tree | b61bd2bbdada795caa3e62d3e0bf007a81dc322e /jfr_playoff/gui/__init__.py | |
parent | 236dfccd6c278f09f8b68e39bf72c456b2733fe5 (diff) |
Window icon fix for Linux systems
Diffstat (limited to 'jfr_playoff/gui/__init__.py')
-rw-r--r-- | jfr_playoff/gui/__init__.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/jfr_playoff/gui/__init__.py b/jfr_playoff/gui/__init__.py index 637e35c..546e1a1 100644 --- a/jfr_playoff/gui/__init__.py +++ b/jfr_playoff/gui/__init__.py @@ -26,17 +26,11 @@ class PlayoffGUI(tk.Tk): ttk.Style().configure('TLabelframe.Label', foreground='black') ttk.Style().configure('TLabelframe', padding=5) self.geometry('920x640') - try: - self.iconbitmap(GuiImage.get_path('icons', 'playoff', 'ico')) - except tk.TclError: - pass # sometimes it fails on Linux, just ignore + self._setWindowIcon(self, GuiImage.get_icon('playoff')) self.tabs = {} self.logWindow = LogWindow(self) self.logWindow.title('Dziennik komunikatów') - try: - self.logWindow.iconbitmap(GuiImage.get_path('icons', 'playoff', 'ico')) - except tk.TclError: - pass # sometimes it fails on Linux, just ignore + self._setWindowIcon(self.logWindow, GuiImage.get_icon('playoff')) self._buildMenu() self.newFileIndex = 0 self._title = tk.StringVar() @@ -65,6 +59,12 @@ class PlayoffGUI(tk.Tk): self.bind('<<BracketError>>', self._onBracketError, add='+') self.mainloop() + def _setWindowIcon(self, window, icon): + try: + self.tk.call('wm', 'iconphoto', window._w, icon) + except tk.TclError: + pass # sometimes it fails on Linux, just ignore + def _onFileChange(self, *args): self._dirty.set(True) |