TomSchimansky / TomSchimansky/CustomTkinter
iconphoto() reverts to default icon
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
iconphoto() always reverts to default icon, while iconbitmap() don't
import tkinter as tk
import customtkinter as ctk
def main():
# creates main window
root = ctk.CTk()
# create icon
icon = tk.PhotoImage(file="icon.png")
# setting app icon
# root.iconbitmap()
root.iconphoto(True, icon) # set as default icon
root.mainloop()
if __name__ == "__main__":
main()
without Line 15 root.iconbitmap() it will reverts to the default icon, while with it, the icon will change.
It's most likely coming from the ctk.CTk._iconbitmap_method_called that only reacts with iconbitmap() and not iconphoto()
Environment:
Windows 11
Python 3.14.5
customtkinter v5.2.2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ctk.CTk entry point and inspect how _iconbitmap_method_called affects window icon handling. Reproduce the provided example on Windows with iconphoto() but without iconbitmap(). Done means the PhotoImage remains the application icon without requiring iconbitmap().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100