How Do I Include Icon Files When Compiling My Python Code?
I am able to set the general Icon for the executable, however, I am having issues compiling the code correctly so that it displays the icon file when I call it for new windows with
Solution 1:
I'll give you an example of how to do it:
from tkinter import Tk
win = Tk()
photo = PhotoImage(file = "Any image file")
win.iconphoto(True, photo)
Let me know if it works.
Solution 2:
Thank you for the help @acw1668! The answer is:
convert png or ico to base64 e.g. https://onlinepngtools.com/convert-png-to-base64 (Other convert tools offer conversion for HTML etc. make sure to delete 'data:...' at the beginning. Use only the raw text).
Image_Data = 'iVBORw0KGgoAAAANSUhEUgAAAQ='window.iconphoto(True, tk.PhotoImage(data=Image_Data))
Post a Comment for "How Do I Include Icon Files When Compiling My Python Code?"