phrack / ShootOFF-legacy

An open source framework to enhance laser dry fire training.
BSD 4-Clause "Original" or "Old" License
30 stars 17 forks source link

Window icon warning on Mac OS X. #112

Closed phrack closed 9 years ago

phrack commented 9 years ago

Jim sent this:

also fixed the "shootoff - WARNING - Failed to set main window icon." message. It turns out that Tkinter.PhotoImage is documented to only handle GIF and PGM/PPM files. So, I converted icon_48x48.png to icon_48x48.gif and changed the code as below. BTW, the original code works in Windows, but that is undocumented. You might want to change this to match the Tinter docs.

    try:

        if platform.system() == "Windows":

            self._window.iconbitmap("images\windows_icon.ico")

        else:

            # JNR, 1/22/2015, changed file from .png to .gif                                             

            icon_img = Tkinter.PhotoImage(file=os.path.join("images", "icon_48x48.gif"))

            self._window.tk.call('wm','iconphoto', self._window._w, icon_img)

    except:

        self._logger.warning("Failed to set main window icon.")

        pass