From c2dab703b1a364ee000f222714cbb9dccf736f92 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 15 Mar 2022 22:55:55 +0100 Subject: Window icon fix for Linux systems --- jfr_playoff/gui/__init__.py | 16 ++++++++-------- jfr_playoff/gui/icons/playoff.gif | Bin 0 -> 2312 bytes 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 jfr_playoff/gui/icons/playoff.gif (limited to 'jfr_playoff') 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('<>', 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) diff --git a/jfr_playoff/gui/icons/playoff.gif b/jfr_playoff/gui/icons/playoff.gif new file mode 100644 index 0000000..2e86704 Binary files /dev/null and b/jfr_playoff/gui/icons/playoff.gif differ -- cgit v1.2.3