-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CTkToplevel overrides any changes to the titlebar icon. #2663
Comments
@63OR63 Try to update it after its check (i.e., after 200 ms). Try the following updated code: try:
resource_path = base_path / APP_ICONS["png"]
sefl._tkimg = tk.PhotoImage(file=resource_path)
self.after(250, lambda: self.iconphoto(True, sefl._tkimg))
except Exception:
pass |
It will certainly work, but the question is: should it be so? It's a flawed approach. I don’t want the titlebar icon to flicker in my app 250 ms after the window opens. Hardcoding icon in |
@63OR63 Yes, it's a known bug. But @TomSchimansky is currently not accepting any fixing PR #2162, so this version of this repository is being continued. To know more, read #2343 . It's appreciable you pointed it out. |
@dipeshSam |
Issue:
CTkToplevel
overrides any custom changes to the titlebar icon.The problem lies in the following code within the
__init__
method ofctk_toplevel.py
(lines 41-47):Context: In CustomTkinter,
iconphoto
is not implemented and calling it doesn't set_iconbitmap_method_called
toTrue
. As a result,CTk
doesn't recognize it was called and overrides the icon settings with a default one. To work around this, I'm wrapping theCTk._windows_set_titlebar_icon
method to ensureiconphoto
can be used without interference.While there’s no check for
_iconbitmap_method_called
or similar in the__init__
method ofctk_toplevel.py
, I'll mention it here for completeness, even though it may not be directly relevant.The text was updated successfully, but these errors were encountered: