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

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

python - how to change an app icon in tkinter? I trayed to look online but it didn't work

I'm traying to make an app GUI using tkinter. how do I change the window icon? I trayed to do:

import tkinter as tk
root = tk.Tk()
root.iconbitmap('app_icon.ico')
root.mainloop
question from:https://stackoverflow.com/questions/65904303/how-to-change-an-app-icon-in-tkinter-i-trayed-to-look-online-but-it-didnt-work

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think you have to show that path to the ico picture, try this:

import tkinter as tk
root = tk.Tk()

root.iconbitmap('/path/to/ico/app_icon.ico')
root.mainloop()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...