0

I have a simple tkinter GUI I've been working on.

I am familiar with changing the icon of the root window using root.iconbitmap("/path/to/icon.ico") and this is what I have been using while writing and testing my code.

However, I am now at the stage of building an installer for the app, which I am doing using cx_freeze. I can do this and install the app on the same pc I wrote it on just fine. However, if I install it on a different pc, it will not work as the specified icon path will not exist on a different pc.

I would like to be able to have the custom window icon appear on other pc's without having to distribute the .ico file along with the installer.

Is there any way I can do this?

1 Answers1

1

Would this example help? You can easily see the idea; and simple change the required name of the file, etc.

import tkinter
from tkinter import *

ikkuna=tkinter.Tk()
ikkuna.title("Let's use own image as icon with no .ico file")
ikonikuva=PhotoImage(file='Experience_in_AI.png')
ikkuna.iconphoto(False,ikonikuva)
ikkuna.mainloop()
Blckknght
  • 100,903
  • 11
  • 120
  • 169
  • Welcome to the site, @Experience_In_AI. This is a pretty good first answer. I've edited it to format the code properly. You might further improve the question by explaining in plain language what the code shows below (e.g. that a `PhotoImage` can be used for the icon). If you have a link to relevant documentation, that might be good to include too! Anyway, thanks for posting a good answer, and welcome again! – Blckknght Mar 31 '21 at 09:17