Open janezgolob opened 1 month ago
I just checked what is the behavior if you would have done this with the base tkinter
library. It doesn't does anything, it just keeps the image the same.
But if you do this:
my_label.configure(image="")
It should clear the image, although you will get a warning its not a CTkImage
.
Right. I actually ended up with two labels on top of each other, using one of them for text and another one for icons. Just to avoid those warnings. I am totally fine if you keep the same behavior, though I would argue that what tkinter does is more accidental behavior than intentional. Maybe adding a warning would help already.
Hi, I looked into the underlying frameworks documentation, the empty string so ""
is the intended way to disable the currently set image.
tk label image
OK. Fine. May I suggest removing that warning then? This one: https://github.com/TomSchimansky/CustomTkinter/blob/b9b57d95c7d3bb821a2260527315b6079161f5c9/customtkinter/windows/widgets/core_widget_classes/ctk_base_class.py#L179
Although it seems strange at first glance, I agree it is best that customtkinter keeps compatibility with tkinter in this sense as well. Thanks, everyone, for looking into this.
I am not sure if this is supposed to be supported, but I naively expected that my_label.configure(image=None) would clear the image from the label.
https://github.com/TomSchimansky/CustomTkinter/blob/b9b57d95c7d3bb821a2260527315b6079161f5c9/customtkinter/windows/widgets/ctk_label.py#L143