TomSchimansky / TomSchimansky/CustomTkinter

iconphoto() reverts to default icon

Open
#2,809 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.