Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 tkinter (like help, about, etc.).

My code looks like this:

Window.iconbitmap(r'snake.ico')

I appreciate the help! Thank you.

question from:https://stackoverflow.com/questions/65948429/how-do-i-include-icon-files-when-compiling-my-python-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...